line1 = Plots.newLine(DataUtil.scaleWithinRange(min, max, points), lineColor, lineLabel);
line1.setLineStyle(LineStyle.newLineStyle(1, 1, 0));
line1.addShapeMarkers(Shape.CIRCLE, lineColor, pointSize);
// Defining chart.
LineChart chart = GCharts.newLineChart(line1);
chart.setSize(w, h);
if (title != null)
chart.setTitle(title, Color.BLACK, 20);
// chart.addHorizontalRangeMarker(40, 60, Color.newColor(Color.RED, 30));
// chart.addVerticalRangeMarker(70, 90, Color.newColor(Color.GREEN, 30));
chart.setGrid(points.size(), 100/(max/10), 2, 1);
// selected indexes - vertical lines
if (selectedIndexes != null)
for (int i=0; i<selectedIndexes.size(); i++)
{
if (selectedIndexes.get(i) >= 0)
{
double position = (double)selectedIndexes.get(i)/points.size()*100;
// to account for rounding errors
if (position < 1)
position = 1;
if (position > 99)
position = 99;
//p(position);
chart.addVerticalRangeMarker(position, position + 1, Color.RED ); // positions must be in [0,100]
}
}
// // Defining axis info and styles
AxisStyle axisStyle = AxisStyle.newAxisStyle(Color.BLACK, axisFontSize, AxisTextAlignment.CENTER);
AxisLabels yAxis = AxisLabelsFactory.newNumericRangeAxisLabels(0, max);
yAxis.setAxisStyle(axisStyle);
// // Adding axis info to chart.
chart.addYAxisLabels(yAxis);
// url
String url = chart.toURLString();
// browse
if (showInBrowser)
net.wigis.svetlin.__Browser.openUrl(url);