Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to chance haxis data display. How to change column color by value

35 views
Skip to first unread message

Erez V.

unread,
Oct 31, 2024, 3:48:34 PM10/31/24
to Google Visualization API
Hello,
Here is the code for a column chart: 
 function drawVisualization_b() {
       
        var data = new google.visualization.DataTable();
data.addColumn('string', 'Couple');
data.addColumn('number', 'profit');


for(var i = 0; i <= datum_b.length-1 ; i++){
datum_b[i].profit=parseFloat(datum_b[i].profit);
var obj = datum_b[i];
data.addRow([obj.item, obj.profit]);
}


 
 
    var options = {
      title :'Profit / Loss of all traded instruments',
      vAxis: {title: 'Balance', gridlines: { count: 10 }},
     
      hAxis: {title: 'Traded Instruments ', direction: 1,
        textPosition : 'out', slantedText: true,
        slantedTextAngle: 60},
  colors:['navy'],
       animation: {
          duration: 1000,
          easing: 'out',
          startup: true},
  bar: { groupWidth: '80%' },
  barVisibilityThreshold :-1,
  seriesType: 'bars'};

    var chart = new google.visualization.ComboChart(document.getElementById('balance_div'));
    chart.draw(data, options);

And Here is how it id displayed : 

When the mouse hovers above the 3 dots on the x axis the name of the item is displayed in a bracket.
I want att items(forex couples) will be displayed slanted
How do I do it ? 

I also want that a column with positive value will be green and a column with negative value will be red
How can it be done ?
chart.png
Reply all
Reply to author
Forward
0 new messages