changing color of volume high/low in highcharts is not changing color -
i have checked link , changed code change color of column no luck change color of volume columns (high/low) in highcharts
i have tried code color not changing in volume column, here code.
<div id="container-ndx" style="height: 500px; width:100%;border-top:2px solid lightgray;"></div> <script> (function($) { var volumecolor = \'\'; var data = []; var ohlc = [], volume = [], datalength = data.length, // set allowed units data grouping groupingunits = [[ \'day\', // unit name [1] // allowed multiples ], [ \'week\', [1, 2, 3, 4, 6] ]], = 0; (i; < datalength; += 1) { ohlc.push([ data[i][0], // date data[i][1], // open data[i][2], // high data[i][3], // low data[i][4] // close ]); if (i==0) { volumecolor = \'#cccccc\'; } else { if (data[i][1] >= data[i-1][1]) { volumecolor = \'#006633\'; } else { volumecolor = \'#cc0033\'; } } volume.push({ x: data[i][0], // date y: data[i][5], color: volumecolor }); console.log(volume); } var options = { chart: { renderto:\'container-ndx\', rangeselector: { inputenabled: false } }, legend: { enabled: true, layout: \'horizontal\', align: \'left\', verticalalign: \'bottom\', x: 0, y: 0, borderwidth: 0 }, title: { text: \'nasdaq etf \' }, xaxis: { type: \'datetime\', datetimelabelformats: { day: \'%e\ %b \%y\' }, showempty: false }, yaxis: [{ labels: { align: \'right\', x: -3, style: { color: \'#f45b5b\' } }, title: { text: \'close\', style: { color: \'#f45b5b\' } }, height: \'60%\', linewidth: 2 }, { labels: { align: \'right\', x: -3 }, title: { text: \'volume\' }, top: \'65%\', height: \'35%\', offset: 0, linewidth: 2 }], tooltip: { shared: true, xdateformat: \'%e\ %b \%y\' }, series: [ { name:\'close\', allowpointselect: true, type:\'candlestick\', color:\'#f45b5b\', upcolor: \'#28c13d\', "yaxis": 0, data:ohlc, datagrouping: { units: groupingunits }, pointinterval: 1*24 * 3600 * 1000, // 1 day pointstart: date.utc(1999, 12, 2) }, { name: \'volume\', allowpointselect: true, "yaxis": 1, data:volume, turbothreshold: number.max_value, datagrouping: { enabled: false, units: groupingunits }, type:\'column\', states: { hover: { enabled: false, linewidth: 2 } }, showinlegend: true, pointinterval: 1*24 * 3600 * 1000, // 1 day pointstart: date.utc(1930, 12, 2) } ] };'; echo 'options.series[0].data = ' . json_encode($datavalue) .';'; echo 'options.series[1].data = ' . json_encode($datavolume) .';'; echo ' var chart = new highcharts.chart(options); })(jquery); </script> ';
Comments
Post a Comment