Home Forums Chart Support Is it possible to push different colors variable to separate multiple striplines

Is it possible to push different colors variable to separate multiple striplines

Viewing 2 posts - 1 through 2 (of 2 total)
  • #27816

    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.

    x: 1,2,3,4
    y: 2,7,8,9
    mColorDigit=[green,red,blue,green,red]

    e.g

    loop{
    var strp1 = (mColorDigit[0]);
    var strp2 = (mColorDigit[1]);
    var strp3 = (mColorDigit[2]);

    loop end
    };

    ————-
    axisX:{
    stripLines:[
    {
    startValue:1.5,
    endValue:2.5,
    color:strp1,
    opacity: .2
    },
    {
    startValue:2.5,
    endValue:3.5,
    color:strp2,
    opacity: .2
    },
    {
    startValue:3.5,
    endValue:4.5,
    color:strp3,
    opacity: .2
    }]

    #27830

    @islandt,

    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.


    Shashi Ranjan
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.