Package com.invient.vaadin.charts

Examples of com.invient.vaadin.charts.InvientChartsConfig$NumberAxis


        addChart(chart);
    }

    private void showScatter() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.SCATTER);
        chartConfig.getGeneralChartConfig().setZoomType(ZoomType.XY);

        chartConfig.getTitle().setText(
                "Height Versus Weight of Individuals by Gender");
        chartConfig.getSubtitle().setText("Source: Heinz  2003");

        chartConfig.getTooltip().setFormatterJsFunc(
                "function() {"
                        + " return '' + this.x + ' cm, ' + this.y + ' kg'; "
                        + "}");

        NumberXAxis xAxis = new NumberXAxis();
        xAxis.setTitle(new AxisTitle("Height (cm)"));
        xAxis.setStartOnTick(true);
        xAxis.setEndOnTick(true);
        xAxis.setShowLastLabel(true);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle("Weight (kg)"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        Legend legend = new Legend();
        legend.setLayout(Layout.VERTICAL);
        Position legendPos = new Position();
        legendPos.setAlign(HorzAlign.LEFT);
        legendPos.setVertAlign(VertAlign.TOP);
        legendPos.setX(100);
        legendPos.setY(70);
        legend.setPosition(legendPos);
        legend.setFloating(true);
        legend.setBorderWidth(1);
        legend.setBackgroundColor(new RGB(255, 255, 255));
        chartConfig.setLegend(legend);

        ScatterConfig scatterCfg = new ScatterConfig();

        SymbolMarker marker = new SymbolMarker(5);
        scatterCfg.setMarker(marker);
        marker.setHoverState(new MarkerState());
        marker.getHoverState().setEnabled(true);
        marker.getHoverState().setLineColor(new RGB(100, 100, 100));
        chartConfig.addSeriesConfig(scatterCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        ScatterConfig femaleScatterCfg = new ScatterConfig();
        femaleScatterCfg.setColor(new RGBA(223, 83, 83, 0.5f));
View Full Code Here


        chart.addSeries(series);
        addChart(chart);
    }

    private void showCombinationScatterWithRegressionLine() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();

        chartConfig.getTitle().setText("Scatter plot with regression line");

        NumberXAxis xAxis = new NumberXAxis();
        xAxis.setMin(-0.5);
        xAxis.setMax(5.5);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setMin(0.0);
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        InvientCharts chart = new InvientCharts(chartConfig);

        // Line series
        LineConfig lineCfg = new LineConfig();
View Full Code Here

        addChart(chart);
    }

    private void showSpline() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE);
        chartConfig.getGeneralChartConfig().setInverted(true);
        chartConfig.getGeneralChartConfig().setWidth(500);

        chartConfig.getTitle().setText("Atmosphere Temperature by Altitude");
        chartConfig.getSubtitle().setText(
                "According to the Standard Atmosphere Model");

        NumberXAxis xAxis = new NumberXAxis();
        xAxis.setReversed(false);
        xAxis.setTitle(new AxisTitle("Altitude"));
        xAxis.setLabel(new XAxisDataLabel());
        xAxis.getLabel().setFormatterJsFunc(
                "function() {" + " return this.value +'km';" + "}");
        xAxis.setMaxPadding(0.05);
        xAxis.setShowLastLabel(true);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle("Temperature"));
        yAxis.setLineWidth(2);
        yAxis.setLabel(new YAxisDataLabel());
        yAxis.getLabel().setFormatterJsFunc(
                "function() {" + " return this.value + '°C';" + "}");
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        //
        Tooltip tooltip = new Tooltip();
        tooltip.setFormatterJsFunc("function() {"
                + " return '' + this.x +' km: '+ this.y +'°C';" + "}");
        chartConfig.setTooltip(tooltip);

        Legend legend = new Legend();
        legend.setEnabled(false);
        chartConfig.setLegend(legend);

        SplineConfig splineCfg = new SplineConfig();
        splineCfg.setMarker(new SymbolMarker(true));
        chartConfig.addSeriesConfig(splineCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries series = new XYSeries("Temperature");
        series.setSeriesPoints(getPoints(series, new double[] { 0, 15 },
View Full Code Here

        addChart(chart);
    }

    private void showSplineWithSymbol() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE);

        chartConfig.getTitle().setText("Monthly Average Temperature");
        chartConfig.getSubtitle().setText("Source: WorldClimate.com");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Jan", "Feb", "Mar", "Apr", "May",
                "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle("Temperature"));
        yAxis.setLabel(new YAxisDataLabel());
        yAxis.getLabel().setFormatterJsFunc(
                "function() {" + " return this.value + '°';" + "}");
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        //
        Tooltip tooltip = new Tooltip();
        tooltip.setCrosshairs(true);
        tooltip.setShared(true);
        chartConfig.setTooltip(tooltip);

        SplineConfig splineCfg = new SplineConfig();
        SymbolMarker symbolMarker = new SymbolMarker(true);
        symbolMarker.setRadius(4);
        symbolMarker.setLineColor(new RGB(102, 102, 102));
        symbolMarker.setLineWidth(1);
        splineCfg.setMarker(symbolMarker);
        chartConfig.addSeriesConfig(splineCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        // Series
        splineCfg = new SplineConfig();
View Full Code Here

TOP

Related Classes of com.invient.vaadin.charts.InvientChartsConfig$NumberAxis

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.