I am making a line chart using GWT and the google Visualization API (https://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted) with the following code
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.visualization.client.AbstractDataTable.ColumnType;
import com.google.gwt.visualization.client.DataTable;
import com.google.gwt.visualization.client.visualizations.LineChart;
import com.google.gwt.visualization.client.visualizations.LineChart.Options;
public class TestPlot {
Widget pie;
static SimplePanel S;
public Widget getLineChart() {
S = new SimplePanel();
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "X");
data.addColumn(ColumnType.NUMBER, "Chanel 1");
data.addColumn(ColumnType.NUMBER, "Channel 2");
data.addRows(2);
data.setValue(0, 0, "0");
data.setValue(0, 1, 0);
data.setValue(0, 2, 0);
data.setValue(1, 0, "1");
data.setValue(1, 1, 4);
data.setValue(1, 2, 1);
Options options = Options.create();
options.setWidth(1000);
options.setHeight(700);
options.setTitle("Test");
options.setEnableTooltip(false);
options.setPointSize(0);
LineChart pie = new LineChart(data, options);
//pie.draw(createTable2());
S.add(pie);
return S;
}
}
I would like to set some options shown on https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart that do not have a method options.setWhatever(). It seems that I need to use the options.setOption(option, value) but I can't get it to work. For example how would I set the two lines from the above example to red and green. I tried:
options.setOption("colors", "['red','green']");
but it doesn't work.