Home › forums › Using CanvasJS › How to "hide" datapoints without leaving blanks (holes) in the chart?
This topic contains 1 reply, has 2 voices, and was last updated by Rishabh Rajgarhia 2 years, 10 months ago.
After hours and hours playing with canvasJS I couldnot find a way to dinamically remove points from my chart in an elegant way. The opposite of that chart on gallery where you add data dinamically.
What I want to do is to allow users to select/deselect data he want to see plotted. For instance, on a chart that shows data from Jan/2014 to Dec/2014 (axisX), if the user choose not to show Feb/2014, I iterate thru dataPoints, remove such point and call render(). The column with data corresponding to frebruary then disapear, but on X axis, the label for february is still shown, creating a “hole”.
If First or Last item is deselected, then the result is OK, such month is not displayed.
I have tried using Date() for x, tried using Integers for x and formating the Date as a label but none worked for me.
So, before starting looking for another solution I would like to know if you gauys could help me out figuring what I`m doing worng.
I think you can use labels instead of x value in this case and use formatDate method in order to format date values as required and use labelFormatter for further customization.
Here is the JSFiddle example.
You must be logged in to reply to this topic.