Search code examples
javagwtgoogle-apigoogle-visualizationgwt-visualization

How to change grid size in gwt-visualization's LineChart?


I am using the 1.1.1 release of gwt-visualization. Here is what I got so far:

final DataTable dataTable;
// creation of the data table left out ..

final Options options = Options.create();

final HorizontalAxisOptions horizontalAxisOptions = HorizontalAxisOptions.create();
horizontalAxisOptions.setShowTextEvery(1);

// ... ?

options.setHAxisOptions(horizontalAxisOptions);

LineChart lineChart = new LineChart(dataTable, options);

Solution

  • The Options.set(key, value)-method(s) generally does the job. However, instead of using the dot notation, one must create nested Options objects (or create wrapper classes like HorizontalAxisOptions).

    But: There's an issue for date values.

    A workaround for this might be the usage of minorGridlines. I suspect that I'll end up in an ugly date calculation. :-(

    Other suggestions?