Open dicktornfeldt opened 1 year ago
Hi, You can set the color of each line in the multiline chart by adding: ->addColor()
$chart->addSeriesPoint('Brand X', $date, $value)->addColor('#b70000');
$chart->addSeriesPoint('Brand Y', $date, $value)->addColor('#239600');
$chart->addSeriesPoint('Brand Z', $date, $value)->addColor('#0619cc');
The documentation tells you to use addColors but this seems to be wrong.
Can we set specific custom color to the different lines in a multiline chart?
Lets say I have 4 different charts on one page.
In two of the graphs there are three different lines (three different brands, X Y and Z). In the third graph, there are only two different lines (two different brands, Y and Z). In the last graph, there are only two different lines (two different brands, X and Z).
I always want brand X, brand Y and brand Z to have their own "brand-color" in all of the charts. Something like:
I know about
setColors([...])
. But with this I can't connect a color to a certain brand as it's not certain that all different brands will be present in all different charts.