Grid line interval problem

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

Grid line interval problem

Post by goodsj » Fri Dec 07, 2018 1:18 am

Hola. :D
tchart.jpg
tchart.jpg (65.26 KiB) Viewed 43324 times

How to change a bottom grid line interval from to one minute ?

I tried to do it, but not works. :?

Always thank you.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Grid line interval problem

Post by Yeray » Mon Dec 10, 2018 7:29 am

Hello,

Could you please arrange a simple example we can run as-is to reproduce the problem and a screenshot showing what would you like/expect to get?

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

Re: Grid line interval problem

Post by goodsj » Mon Dec 10, 2018 8:29 am

Hello, Yeray.
Thank you for your reply.

before.
tchart_before.jpg
tchart_before.jpg (87.61 KiB) Viewed 43315 times
I would like to add more delicate vertical line than before.

after.( I wish)
tchart_after.jpg
tchart_after.jpg (107.05 KiB) Viewed 43315 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Grid line interval problem

Post by Yeray » Tue Dec 11, 2018 3:21 pm

Hello,

You can draw extra grid lines following this example:
chrome_2018-12-11_16-21-47.png
chrome_2018-12-11_16-21-47.png (39.8 KiB) Viewed 43309 times

Code: Select all

var Chart1;

function draw() {
  Chart1=new Tee.Chart("canvas");

  Chart1.addSeries(new Tee.Line().addRandom());

  Chart1.series.items[0].beforeDraw = function() {
  	var c = Chart1.ctx;
  	var a = Chart1.axes.bottom;
  	var v = a.roundMin();

  	var y1 = a.bounds.y;
  	var y2 = Chart1.chartRect.y;

  	c.beginPath();
  	while (v <= a.maximum) {
  		var step = (a.increm / 3);
		var i = v + step;
		while (i < v + a.increm) {
			if ((i > a.minimum) && (i < a.maximum)) {
				var p = a.calc(i);
				c.moveTo(p, y1);
				c.lineTo(p, y2);
			}

			i += step;
		}

  		v += a.increm;
	}
	  a.grid.format.stroke.prepare();
	  a.grid.format.shadow.prepare(c);

	  c.stroke();
  }

  Chart1.draw();
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply