Page 1 of 1

teechart JS : on hover of chart getting RangeError: Maximum call stack size exceeded

Posted: Wed Oct 24, 2018 9:46 am
by 17781208
On hover of MD chart it is showing error in console " ERROR RangeError: Maximum call stack size exceeded".
Can you please suggest how to resolve it.
And on hover of MD chart we don't want to see all chart values and just want to see green lines custom info(Means title).

while Zooming how to make this color graph smooth zooming.Attached a screen shot where we are zooming using .net teechart control getting expected result.

Re: teechart JS : on hover of chart getting RangeError: Maximum call stack size exceeded

Posted: Fri Oct 26, 2018 1:11 pm
by yeray
Hello,

Regarding the RangeError, debugging your sources, I see a couple of issues:
First, you are calling your startRefresh method at the end of your redrawMdLine:

Code: Select all

		function redrawMdLine() {
			//...
			if (isLive) {
				startRefresh();
				isLive = false;
			}
		}
And the startRefresh code calls the redrawMdLine function again:

Code: Select all

		function startRefresh() {
			setInterval(redrawMdLine(), 5000);
		}
So basically, you are creating an endless loop here. And you are adding 10 new Line series each time redrawMdLine is called, which I'm not sure if it's what you wanted to do.
Try changing the isLive flag before calling startRefresh:

Code: Select all

		function redrawMdLine() {
			//...
			if (isLive) {
				isLive = false;
				startRefresh();
			}
		}
Secondly, you are reassigning the tip.old_refresh in that redrawMdLine function. And this is calling itself several times. I would just remove that part of code:

Code: Select all

		function redrawMdLine() {
			//...			
			
			/*tip.old_refresh = tip.refresh;
			tip.refresh = function (series, index) {
				if (series !== mdChart.series.items[0]) {
					tip.old_refresh(series, index);
				}
			}*/

			//...
		}
Ashutosh wrote:
Wed Oct 24, 2018 9:46 am
And on hover of MD chart we don't want to see all chart values and just want to see green lines custom info(Means title).
I don't see titles assigned to the lines, so I'm adding them. Then, you could use the tip.ongettext to get the series title:

Code: Select all

		function drawMD(data) {
			//...
			for (i = 0; i < lineArray.length; i++) {
				//...
				line.title = "Mean " + i;
			}

			//...
			tip.ongettext=function(tip,text,series,index) {
				return series.title;
			}
			//...
		}
Ashutosh wrote:
Wed Oct 24, 2018 9:46 am
while Zooming how to make this color graph smooth zooming.Attached a screen shot where we are zooming using .net teechart control getting expected result.
The example here seems to do the smoothed=false correctly.

Re: teechart JS : on hover of chart getting RangeError: Maximum call stack size exceeded

Posted: Tue Oct 30, 2018 9:20 am
by 17781208
Actually MD chart will be refresh every time and lines will be drawn in different positions. So that every time on hover of line we need to show the title. And one more thing is on hover of chart values are showing and out of chart also it is reflecting. Actually we don't need to show all the values except on hover of lines. Please give us solution like this. If any doubt, we will give clarity on that.

Regards,
Ashutosh

Re: teechart JS : on hover of chart getting RangeError: Maximum call stack size exceeded

Posted: Wed Nov 14, 2018 12:43 pm
by yeray
Hello,

We've discussed this through mail but if anyone else comes here and wants to know the solution to the issues exposed here we go.
Ashutosh wrote:
Tue Oct 30, 2018 9:20 am
Actually MD chart will be refresh every time and lines will be drawn in different positions. So that every time on hover of line we need to show the title.
That's the purpose of the ToolTip ongettext event:

Code: Select all

			tip.ongettext=function(tip,text,series,index) {
				return series.title;
			}
Ashutosh wrote:
Tue Oct 30, 2018 9:20 am
And one more thing is on hover of chart values are showing and out of chart also it is reflecting. Actually we don't need to show all the values except on hover of lines.
That was the purpose of the redefinition of the ToolTip refresh function, to ensure the ToolTip responds to all the series in that chart except on the first one:

Code: Select all

			tip.old_refresh = tip.refresh;
			tip.refresh = function (series, index) {
				if (series !== mdChart.series.items[0]) {
					tip.old_refresh(series, index);
				}
				else {
					tip.hide();
				}
			}