1

This example code below is generated using GEE Data Table Charts Section.

How can I print all table rows (they go to display in two pages) in one page and numbers in the second column with two decimal places?

// Define a DataTable using a JavaScript array with a column property header.
var dataTable = [
  [
    {label: 'State', role: 'domain', type: 'string'},
    {label: 'Population', role: 'data', type: 'number'},
  ],
  ['CA', 37253.956],
  ['NY', 19378.102],
  ['IL', 12830],
  ['MI', 9883],
  ['OR', 3831.234],
  ['CA', 37253.956],
  ['NY', 19378.102],
  ['IL', 12830],
  ['MI', 9883],
  ['OR', 3831.234],
  ['CA', 37253.956],
  ['NY', 19378.102],
  ['IL', 12830],
  ['MI', 9883],
  ['OR', 3831.234]
];

// Define the chart and print it to the console.
var chart = ui.Chart(dataTable).setChartType('Table').setOptions({
  format : '#.###',
  title: 'State Population (US census, 2010)',
  legend: {position: 'none'},
  colors: ['1d6b99'],
  page:'disable'
});
print(chart);

1 Answer 1

1

You have to set allowHtml as true and then you can use all the css configurations.

var chart = ui.Chart(dataTable).setChartType('Table').setOptions({
  format : '#.###',
  title: 'State Population (US census, 2010)',
  legend: {position: 'none'},
  colors: ['1d6b99'],
  page:'disable',
  allowHtml: true,
  pageSize:20
})
2
  • Thank you very much, Rahul... Feb 25, 2023 at 8:51
  • Dear Rahul, how about the format of numbers, when i set the format as #.##, there is error in displaying numbers, it is displayed like ###.## Feb 25, 2023 at 9:10

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.