Search in sources :

Example 6 with Crosshair

use of com.vaadin.addon.charts.model.Crosshair in project charts by vaadin.

the class BasicLineWithCustomCrosshairs method getChart.

@Override
protected Component getChart() {
    Chart chart = new Chart();
    chart.setId("chart");
    Configuration config = chart.getConfiguration();
    config.setTitle("Customized crosshairs");
    Crosshair xCrossHair = new Crosshair();
    xCrossHair.setColor(SolidColor.BLACK);
    xCrossHair.setDashStyle(DashStyle.SOLID);
    xCrossHair.setWidth(10);
    xCrossHair.setZIndex(0);
    config.getxAxis().setCrosshair(xCrossHair);
    Crosshair yCrossHair = new Crosshair();
    yCrossHair.setColor(new SolidColor("#880000"));
    yCrossHair.setDashStyle(DashStyle.DOT);
    yCrossHair.setWidth(5);
    yCrossHair.setZIndex(1);
    config.getyAxis().setCrosshair(yCrossHair);
    ListSeries ls = new ListSeries();
    ls.setName("Data");
    ls.setData(29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4);
    config.setSeries(ls);
    chart.drawChart(config);
    return chart;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) ListSeries(com.vaadin.addon.charts.model.ListSeries) Crosshair(com.vaadin.addon.charts.model.Crosshair) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Chart(com.vaadin.addon.charts.Chart)

Aggregations

Chart (com.vaadin.addon.charts.Chart)6 Configuration (com.vaadin.addon.charts.model.Configuration)6 Crosshair (com.vaadin.addon.charts.model.Crosshair)6 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)4 ListSeries (com.vaadin.addon.charts.model.ListSeries)3 YAxis (com.vaadin.addon.charts.model.YAxis)3 RangeSeries (com.vaadin.addon.charts.model.RangeSeries)2 Tooltip (com.vaadin.addon.charts.model.Tooltip)2 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)1 DataLabels (com.vaadin.addon.charts.model.DataLabels)1 DataSeries (com.vaadin.addon.charts.model.DataSeries)1 Labels (com.vaadin.addon.charts.model.Labels)1 Marker (com.vaadin.addon.charts.model.Marker)1 MarkerSymbolUrl (com.vaadin.addon.charts.model.MarkerSymbolUrl)1 PlotOptionsAreaspline (com.vaadin.addon.charts.model.PlotOptionsAreaspline)1 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)1 XAxis (com.vaadin.addon.charts.model.XAxis)1