Home › forums › Using CanvasJS › Is it possible to push different colors variable to separate multiple striplines
I started by using push variables to the dataPoints:
to a dynamic line chart
And wanted to add dynamic striplines colors to mulitiple striplines e.g
color:strp1, color:strp2, color:strp3 as the color is inside a loop the variable is not working to place the color but work outside the loop.
var strp1 = (mColorDigit);
var strp2 = (mColorDigit);
var strp3 = (mColorDigit);
Please refer this page for more information on color codes supported by CanvasJS. Changing mColorDigit=[green,red,blue,green,red] to mColorDigit=['green','red','blue','green','red'] should work fine in your case.
If you are still facing the issue, kindly create a JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out?
From what we have observed, sometimes things get delayed mostly when we are not able to reproduce the issue or not able to understand the exact requirements or the solution that we provide may not work properly due to the variation in chart-options being used by you and us.
Having a JSFiddle helps us in figuring out the issue and many a time we can just edit your code on JSFiddle to fix the issue right away.
You must be logged in to reply to this topic.