0

Does anyone know how to make labels place in the same position, though it is on or in the graphic? And how to change the range of vertical axis. In the following picture, we can see the range of vAxis is from 60 to 120, I want to change it from 0 to 150 or manually

enter image description here

here is the code

// Make Chart Area
  var dataTable = [
    [
      {label: 'State', role: 'domain', type: 'string'},
      {label: 'Luas (Ha)', role: 'data', type: 'number'},
      {label: 'Pop. annotation', role: 'annotation', type: 'string'}
    ],
     ['1990', 98.67621380335447, '98.7'],
     ['2000', 70.88686877217545, '70.9'],
     ['2010', 109.28949721175634, '109.3'],
     ['2020', 119.91043838041222, '119.9']
    ];

  // Define the chart and print it to the console.
  var chart_area_mangrove = ui.Chart(dataTable).setChartType('ColumnChart').setOptions({
    title: 'Luasan Hutan Mangrove dari 1990 - 2020',
    legend: {position: 'none'},
    hAxis: {title: 'Tahun', titleTextStyle: {italic: false, bold: true}},
    vAxis: {title: 'Luas (Ha)', titleTextStyle: {italic: false, bold: true},min:0},
    colors: ['00a701']
  });
print(chart_area_mangrove);

1 Answer 1

0

If you want to force your vertical axis values you need to add a minValue and maxValue property to your vAxis in setOptions, like this vAxis: {minValue:0, maxValue: 150}. As for changing the position of the column labels, I'm not sure it can be done. However, you can stretch the console or open it in another window and they'll appear at the top of each column like this: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.