Page 1 of 1

Grid line interval problem

Posted: Fri Dec 07, 2018 1:18 am
by 16082909
Hola. :D
tchart.jpg
tchart.jpg (65.26 KiB) Viewed 44998 times

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

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

Always thank you.

Re: Grid line interval problem

Posted: Mon Dec 10, 2018 7:29 am
by yeray
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.

Re: Grid line interval problem

Posted: Mon Dec 10, 2018 8:29 am
by 16082909
Hello, Yeray.
Thank you for your reply.

before.
tchart_before.jpg
tchart_before.jpg (87.61 KiB) Viewed 44989 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 44989 times

Re: Grid line interval problem

Posted: Tue Dec 11, 2018 3:21 pm
by yeray
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 44983 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();
}