Search in sources :

Example 36 with YAxis

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

the class GettingStarted method addColumnsSnippet2.

public void addColumnsSnippet2(List<WeatherInfo> weatherInfo, DataProviderSeries<WeatherInfo> humidity, Configuration conf) {
    YAxis humidityYAxis = new YAxis();
    humidityYAxis.setTitle("Humidity (%)");
    humidityYAxis.setMin(0);
    humidityYAxis.setOpposite(true);
    conf.addyAxis(humidityYAxis);
    humidity.setyAxis(humidityYAxis);
}
Also used : YAxis(com.vaadin.addon.charts.model.YAxis)

Example 37 with YAxis

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

the class ChartConfiguration method formattingSnippet1.

public void formattingSnippet1(Configuration configuration) {
    YAxis yaxis = new YAxis();
    Labels ylabels = yaxis.getLabels();
    ylabels.setFormatter("function() {return this.value + ' km';}");
}
Also used : Labels(com.vaadin.addon.charts.model.Labels) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 38 with YAxis

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

the class ChartTypes method chartTypesGaugeAxisSnippet1.

public void chartTypesGaugeAxisSnippet1() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    YAxis yaxis = new YAxis();
    yaxis.setTitle("km/h");
    // The limits are mandatory
    yaxis.setMin(0);
    yaxis.setMax(100);
    // Other configuration
    yaxis.getLabels().setStep(1);
    yaxis.setTickInterval(10);
    yaxis.setTickLength(10);
    yaxis.setTickWidth(1);
    yaxis.setMinorTickInterval("1");
    yaxis.setMinorTickLength(5);
    yaxis.setMinorTickWidth(1);
    yaxis.setPlotBands(new PlotBand[] { new PlotBand(0, 60, SolidColor.GREEN), new PlotBand(60, 80, SolidColor.YELLOW), new PlotBand(80, 100, SolidColor.RED) });
    // Disable grid
    yaxis.setGridLineWidth(0);
    conf.addyAxis(yaxis);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) PlotBand(com.vaadin.addon.charts.model.PlotBand) Chart(com.vaadin.addon.charts.Chart) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 39 with YAxis

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

the class ChartTypes method chartTypesWaterfall.

public void chartTypesWaterfall() {
    Chart chart = new Chart(ChartType.WATERFALL);
    chart.setWidth("500px");
    chart.setHeight("350px");
    // Modify the default configuration a bit
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Changes in Reindeer Population in 2011");
    conf.getLegend().setEnabled(false);
    // Configure X axis
    XAxis xaxis = new XAxis();
    xaxis.setCategories("Start", "Predators", "Slaughter", "Reproduction", "End");
    conf.addxAxis(xaxis);
    // Configure Y axis
    YAxis yaxis = new YAxis();
    yaxis.setTitle("Population (thousands)");
    conf.addyAxis(yaxis);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 40 with YAxis

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

the class MasterDetailChart method getMasterChart.

private Chart getMasterChart() {
    Chart masterChart = new Chart(ChartType.AREA);
    masterChart.setHeight("80px");
    masterChart.setWidth("100%");
    masterChart.setId("master-chart");
    Configuration configuration = masterChart.getConfiguration();
    configuration.getChart().setZoomType(ZoomType.X);
    configuration.getChart().setReflow(false);
    configuration.getChart().setBorderWidth(0);
    configuration.getChart().setBackgroundColor(null);
    configuration.getChart().setMarginLeft(50);
    configuration.getChart().setMarginRight(20);
    configuration.getTitle().setText("");
    configuration.getxAxis().setType(AxisType.DATETIME);
    configuration.getxAxis().setShowLastLabel(true);
    configuration.getxAxis().setMinRange(14 * DAY_IN_MILLIS);
    configuration.getxAxis().setTitle(new AxisTitle(""));
    PlotBand mask = new PlotBand();
    mask.setColor(new SolidColor(0, 0, 0, 0.2));
    mask.setFrom(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
    mask.setTo(Util.toHighchartsTS(DEMO_DATASET_END.atStartOfDay().toInstant(ZoneOffset.UTC)));
    configuration.getxAxis().setPlotBands(mask);
    YAxis yAxis = configuration.getyAxis();
    yAxis.setGridLineWidth(0);
    yAxis.setLabels(new Labels(false));
    yAxis.setTitle(new AxisTitle(""));
    yAxis.setMin(0.6);
    yAxis.setShowFirstLabel(false);
    configuration.getTooltip().setEnabled(false);
    configuration.getLegend().setEnabled(false);
    configuration.getCredits().setEnabled(false);
    PlotOptionsArea plotOptions = new PlotOptionsArea();
    plotOptions.setLineWidth(1);
    plotOptions.setShadow(false);
    Hover hover = new Hover();
    hover.setLineWidth(1);
    States states = new States();
    states.setHover(hover);
    plotOptions.setStates(states);
    plotOptions.setEnableMouseTracking(false);
    plotOptions.setAnimation(false);
    configuration.setPlotOptions(plotOptions);
    ListSeries ls = new ListSeries();
    PlotOptionsArea masterPlotOptions = new PlotOptionsArea();
    GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
    fillColor.addColorStop(0, new SolidColor(69, 114, 167, 1));
    fillColor.addColorStop(1, new SolidColor(69, 114, 167, 0.5));
    masterPlotOptions.setFillColor(fillColor);
    masterPlotOptions.setPointInterval(24 * 3600 * 1000);
    masterPlotOptions.setMarker(new Marker(false));
    masterPlotOptions.setPointStart(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
    ls.setPlotOptions(masterPlotOptions);
    ls.setName("USD to EUR");
    ls.setData(FULL_DEMO_DATA_SET);
    configuration.addSeries(ls);
    masterChart.drawChart(configuration);
    return masterChart;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Labels(com.vaadin.addon.charts.model.Labels) Marker(com.vaadin.addon.charts.model.Marker) States(com.vaadin.addon.charts.model.States) PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) ListSeries(com.vaadin.addon.charts.model.ListSeries) Hover(com.vaadin.addon.charts.model.Hover) AxisTitle(com.vaadin.addon.charts.model.AxisTitle) PlotBand(com.vaadin.addon.charts.model.PlotBand) Chart(com.vaadin.addon.charts.Chart) YAxis(com.vaadin.addon.charts.model.YAxis)

Aggregations

YAxis (com.vaadin.addon.charts.model.YAxis)115 Chart (com.vaadin.addon.charts.Chart)105 Configuration (com.vaadin.addon.charts.model.Configuration)100 XAxis (com.vaadin.addon.charts.model.XAxis)63 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)51 ListSeries (com.vaadin.addon.charts.model.ListSeries)46 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)40 DataSeries (com.vaadin.addon.charts.model.DataSeries)39 Tooltip (com.vaadin.addon.charts.model.Tooltip)39 DataLabels (com.vaadin.addon.charts.model.DataLabels)30 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)28 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)27 Legend (com.vaadin.addon.charts.model.Legend)24 Labels (com.vaadin.addon.charts.model.Labels)19 Marker (com.vaadin.addon.charts.model.Marker)16 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)14 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)13 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)13 Title (com.vaadin.addon.charts.model.Title)13 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)13