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

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
Ashutosh
Newbie
Newbie
Posts: 4
Joined: Tue Jun 20, 2017 12:00 am

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

Post by Ashutosh » Wed Oct 24, 2018 9:46 am

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.
Attachments
steemaJsZoomed.png
steemaJsZoomed.png (291.15 KiB) Viewed 27509 times
Expected zoom.png
Expected zoom.png (136.16 KiB) Viewed 27509 times
eventInfoTest.zip
(276.11 KiB) Downloaded 1227 times

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

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

Post by Yeray » Fri Oct 26, 2018 1:11 pm

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.
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

Ashutosh
Newbie
Newbie
Posts: 4
Joined: Tue Jun 20, 2017 12:00 am

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

Post by Ashutosh » 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. 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

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

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

Post by Yeray » Wed Nov 14, 2018 12:43 pm

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();
				}
			}
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