I am making a financial chart I have two charts on the same page and I have a problem with displaying markers, I need to display each marker according to the color that is saved in the database, I have a dataset with some values and char field that contains the color name (yellow, green...) I need to display markers in a color that is saved in the database. For example, one marker can be green but another can be black. I don't know how to do that this is my best guess. Also, don't be confused with Django template syntax it is used to iterate over data in the backend only and to create a list of data that will be used for the chart.
const dataCCI = []
{%for stock in stocks %}
dataCCI.push([
new Date("{{stock.date}}").toISOString().slice(0, 10), 20, 'red'],)
{% endfor %}
var ibmDataTable = anychart.data.table();
ibmDataTable.addData(dataCCI)
var plotSecond = chart.plot(1);
plotSecond.height('30%');
// create plot series with mapped data
var IBM = plotSecond
.marker(ibmDataTable)
.name('IBM');
I tried multiple examples and everything that came to my mind but I only managed to display markers with only default color.
Proper mapping of your data can fix your problem.
If your data contains color names or values, you can add them as an appearance option in your mapping.
// create data
var data = [
["January", 12000, "red"],
["February", 15000, "blue"],
["March", 16000, "#333555"],
["April", 14000, "#aaaaaa"],
["May", 10000, "aqua"]
];
// map the data
var mapping1 = dataSet.mapAs({x: 0, value: 1, fill: 2});
You may see an example of how to use mapping to apply colors from your data.
In addition, our documentation has all of the complex information concerning mapping.