How to manually set a color of a LineSeries via json config in amcharts v4?
I've tried lots of properties and it had no effect:
...
"series": [
{
"type": "LineSeries",
"propertyFields": {
"stroke": "#color",
"fill": "#color"
}
},
{
"type": "LineSeries",
"color": "#color"
},
{
"type": "LineSeries",
"fill": "#color"
},
{
"type": "LineSeries",
"sprite": {
"color": "#color"
}
},
{
"type": "LineSeries",
"sprite": {
"fill": "#color"
}
},
{
"type": "LineSeries",
"stroke": {
"color": "#color"
}
},
{
"type": "LineSeries",
"stroke": {
"fill": "#color"
}
}
]
Does amcharts v4 have a simple and easy way to manually set a color of a line?
You almost had it. You have to set the stroke
at the top-level of the LineSeries definition (see JSON tab in the docs):
"series": [{
"type": "LineSeries",
"stroke": "#567890",
// ...
},
// ...
]
JSON values line up very closely to the declarative syntax, hierarchy-wise. You can find more full JSON examples in the github repo.