lineColor: String

Sets the color of line for the entire series. This can be overridden at dataPoint level in order to customize the color of line connecting any two dataPoints. The value of lineColor can be a “HTML Color Name” or “hex” code.

Default: Automatically taken from dataSeries color.
Example: “blue”,”#21AB13″..
Note
  • Color of the lineSegment is defined by the lineColor of first dataPoint
  • Applies only to all Line and Area charts.
  • When not set, lineColor for each dataSeries is chosen from the user defined color or from the default theme.
var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 data:[{
   lineColor: "red",
  },
 ]
 .
 .
});
chart.render();

Try Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question

4 Comments

  1. nef ron says:

    Can you change line color on an if else? If line is below 0, color it red. If above 0, color it black?

    • Vishwas R says:

      Nef ron,

      Its not possible what exactly you are looking for, but you can change the lineColor based on dataPoint y-value. Here is a fiddle.

If you have any questions, please feel free to ask in our forums. Ask Question