Sets the color of dataSeries. The value of color can be a “HTML Color Name” or “Hex Code”.
var chart = new CanvasJS.Chart("container", { . . data:[{ color: "red", }, ] . . }); chart.render();
Also See:
Comments 7
Server Side Technologies |
Front End Technologies |
Contact |
|
---|---|---|---|
ASP.NET MVC Charts | JavaScript Charts | FAQs | |
PHP Charts | jQuery Charts | Sales Enquiries | |
Spring MVC Charts | React Charts | Support Forum | |
JSP Charts | Angular Charts | Careers | |
JavaScript StockCharts | |||
Privacy Policy © fenopix
Is there a way to query the color when has not been explicitly specified?
Carl,
We don’t have this option as of now. We will consider it for future versions though.
Is it possible to set a threshold for the color? For example if number is less than 80 then “red” else “green”
Never mind I figured out how to do this utilizing variables and a JavaScript if/else statement
//Set WMW Colorset
if (wmwemp < 80) {
var wmwempc = "red";
} else {
var wmwempc = "#4E83B8";
}
if (wmwcred < 80) {
var wmwcredc = "red";
} else {
var wmwcredc = "#7fa6cc";
}
if (wmwmed < 80) {
var wmwmedc = "red";
} else {
var wmwmedc = "#b6cce2";
}
CanvasJS.addColorSet("wmwcolorset",
[wmwempc,
wmwcredc,
wmwmedc,
]);
Yes it is possible to set color according to the requirement .
is it possible to get auto assigned color to each data series ?
Sorry, it is not possible unless you mention the color yourself.