mercredi 7 novembre 2018

How to set AnyChart Candlestick colors dynamic?

I want to set Candlestick Colors dynamically. But i don't know how.

So i passed the Parameter true as said on anychart Doc to anychart.stock constructor und defined a field caled color on Dataset with mapped field as example showed below.

Anyone get a Solutions ?

Ref to Dok: https://docs.anychart.com/Stock_Charts/Data#individual_point_settings

anychart.onDocumentReady(function () {

// create a data table
var table = anychart.data.table('x');
// add data
table.addData([

{'x':'2015-12-24', 'open': 511.53, 'high': 514.98, 'low': 505.79, 'close': 506.40,'fill' : '#00FF00'} ]);

// create a stock chart
var chart = anychart.stock(true);

// create a mapping
var mapping = table.mapAs({'open':'open', 'high': 'high', 'low': 'low', 'close': 'close','fill':'fill'});

// add a series using the mapping
chart.plot(0).candlestick(mapping).name('ACME Corp.');

// set container id for the chart
chart.container('container');

// initiate chart drawing
chart.draw();

});




Aucun commentaire:

Enregistrer un commentaire