Add a "style" role column to the DataTable, specifying a color string for
each candlestick you want to change the color of::
var dataTable = google.visualization.arrayToDataTable([
['day', 'low', 'open', 'close', 'high', {type: 'string', role:
'style'}],
['Mon', 20, 28, 38, 45, null],
['Tue', 31, 38, 55, 66, '#FF0000'],
['Wed', 50, 55, 77, 80, null],
['Thu', 77, 77, 66, 50, null],
['Fri', 68, 66, 22, 15, null]
]);
On Friday, April 18, 2014 10:30:01 AM UTC-4, Mark Norris wrote:
>
> Is there a way to make certain candlesticks a different color when using
> the Google Charts API?
>
> For example, take a look at the following (editable) candlestick chart:
>
>
> https://code.google.com/apis/ajax/playground/?type=visualization#candlestick_chart
>
> function drawVisualization() {
> // Populate the data table.
> var dataTable = google.visualization.arrayToDataTable([
> ['Mon', 20, 28, 38, 45],
> ['Tue', 31, 38, 55, 66],
> ['Wed', 50, 55, 77, 80],
> ['Thu', 77, 77, 66, 50],
> ['Fri', 68, 66, 22, 15]
> // Treat first row as data as well.
> ], true);
>
> // Draw the chart.
> var chart = new
> google.visualization.CandlestickChart(document.getElementById('visualization'));
> chart.draw(dataTable, {legend:'none', width:600, height:400});}
>
> Is there a way to make, say, just the 'Tue' candlestick red while keeping
> the rest blue/white?
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.