jQuery UI Widgets › Forums › Chart › Colorfunction in chart not working
Tagged: chart, colorFunction, multiple colors
This topic contains 5 replies, has 3 voices, and was last updated by marconian 8 years, 9 months ago.
-
Author
-
Hello,
We are using a JqWidgets Chart to display measurements of groundwater in our area. In the chart we’re using a colorFunction to display the data in a line serie that is validated, according to their status: blue for valid; red for invalid; and gray for unvalidated.
However sometimes the line is not colored correctly. It seems to change according to the period of time that is shown in the graph. In some occasions it is drawn correctly on load. Other times it isn’t. What happens then is that the line is colored completely gray or a part of the line disappears.
I posted our code on jsfiddle:
– https://jsfiddle.net/marcoflier/ygfkr5ae/
We where unable to find the reason for this behaviour, so we’re hoping someone here is able to help us.Hi marconian,
The line is rendered in the color returned by the colorFunction at the time the chart is updated. The chart is updated when you move the range selector or update it by changing its data source or call it’s refresh, update methods. We cannot identify an issue.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThe first part of the line should always be blue, because the data of the first part has a value in the VALIDATE column of 1. The last part should always be gray because the value there is 0. Still it is sometimes rendered completely gray, or a part of the line disappears.
In Visual Studio I put breakpoints in the colorFunction. The function always returns the correct value, even if the line isn’t rendered correctly.
I tested it in IE11, Chrome and Firefox. In all browsers the issue is the same. I added some screenshots of the jsFiddle to show you the issue.
– https://drive.google.com/file/d/0B86_iCzuVYsPbFh5Q3VyZUQ4YXc/view?usp=sharing
– https://drive.google.com/file/d/0B86_iCzuVYsPdUx2NW5MWFNtWXM/view?usp=sharingYou can see the issue when you change the period with the rangeselector.
Best Regards,
Marco FlierHi marconian,
Thanks for feedback. As a workaround do this: enableSampling: false in the chart’s settings.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello Peter,
Thanks for your solution. It’s working with ‘enableSampling’ set to false.Best Regards,
Marco Flier -
AuthorPosts
You must be logged in to reply to this topic.