Package com.invient.vaadin.charts

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


        addChart(chart);

    }

    private void showColumnWithNegValues() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN);

        chartConfig.getTitle().setText("Column chart with negative values");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Oranges", "Pears",
                "Grapes", "Bananas"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        Tooltip tooltip = new Tooltip();
        tooltip.setFormatterJsFunc("function() {"
                + " return '' + this.series.name +': '+ this.y +''; " + "}");
        chartConfig.setTooltip(tooltip);
        chartConfig.getCredit().setEnabled(false);

        InvientCharts chart = new InvientCharts(chartConfig);
        XYSeries seriesData = new XYSeries("John");
        seriesData.setSeriesPoints(getPoints(seriesData, 5, 3, 4, 7, 2));
        chart.addSeries(seriesData);
View Full Code Here


        // Add detail
        addChart(detailChart, true, true, false);
    }

    private InvientCharts getDetailChart(InvientCharts masterChart) {
        InvientChartsConfig detailChartConfig = new InvientChartsConfig();
        detailChartConfig.getGeneralChartConfig().setMargin(new Margin());
        detailChartConfig.getGeneralChartConfig().getMargin().setBottom(120);
        detailChartConfig.getGeneralChartConfig().getMargin().setLeft(50);
        detailChartConfig.getGeneralChartConfig().getMargin().setRight(20);
        detailChartConfig.getGeneralChartConfig().setReflow(false);

        detailChartConfig.getCredit().setEnabled(false);

        detailChartConfig.getTitle().setText(
                "Historical USD to EUR Exchange Rate");

        detailChartConfig.getSubtitle().setText(
                "Select an area by dragging across the lower chart");

        DateTimeAxis detailXAxis = new DateTimeAxis();
        LinkedHashSet<XAxis> detailXAxes = new LinkedHashSet<InvientChartsConfig.XAxis>();
        detailXAxes.add(detailXAxis);
        detailChartConfig.setXAxes(detailXAxes);

        NumberYAxis detailYAxis = new NumberYAxis();
        detailYAxis.setTitle(new AxisTitle(""));
        LinkedHashSet<YAxis> detailYAxes = new LinkedHashSet<InvientChartsConfig.YAxis>();
        detailYAxes.add(detailYAxis);
        detailChartConfig.setYAxes(detailYAxes);

        detailChartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " var point = this.points[0];"
                                + " return '<b>'+ point.series.name +'</b><br/>' + "
                                + " $wnd.Highcharts.dateFormat('%A %B %e %Y', this.x) + ':<br/>' + "
                                + " '1 USD = '+ $wnd.Highcharts.numberFormat(point.y, 2) +' EUR';"
                                + "}");
        detailChartConfig.getTooltip().setShared(true);

        detailChartConfig.getLegend().setEnabled(false);

        LineConfig lineCfg = new LineConfig();
        SymbolMarker marker = new SymbolMarker(false);
        lineCfg.setMarker(marker);
        marker.setHoverState(new MarkerState());
        marker.getHoverState().setEnabled(true);
        marker.getHoverState().setRadius(3);
        detailChartConfig.addSeriesConfig(lineCfg);

        InvientCharts detailChart = new InvientCharts(detailChartConfig);

        // Line instance configuration
        LineConfig lineSeriesCfg = new LineConfig();
View Full Code Here

        addChart(chart);
    }

    private void showColumnStacked() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN);

        chartConfig.getTitle().setText("Stacked column chart");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Oranges", "Pears",
                "Grapes", "Bananas"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setMin(0.0);
        yAxis.setTitle(new AxisTitle("Total fruit consumption"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        Legend legend = new Legend();
        legend.setPosition(new Position());
        legend.getPosition().setAlign(HorzAlign.RIGHT);
        legend.getPosition().setVertAlign(VertAlign.TOP);
        legend.getPosition().setX(-100);
        legend.getPosition().setY(20);
        legend.setFloating(true);
        legend.setBackgroundColor(new RGB(255, 255, 255));
        legend.setBorderWidth(1);
        legend.setShadow(true);
        chartConfig.setLegend(legend);

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return '<b>'+ this.x +'</b><br/>'+ this.series.name +': '+ this.y +'<br/>'+"
                                + "        'Total: '+ this.point.stackTotal; "
                                + "}");

        ColumnConfig colCfg = new ColumnConfig();
        colCfg.setStacking(Stacking.NORMAL);
        chartConfig.addSeriesConfig(colCfg);

        InvientCharts chart = new InvientCharts(chartConfig);
        XYSeries seriesData = new XYSeries("John");
        seriesData.setSeriesPoints(getPoints(seriesData, 5, 3, 4, 7, 2));
        chart.addSeries(seriesData);
View Full Code Here

        addChart(chart);
    }

    private void showColumnStackedAndGrouped() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN);

        chartConfig.getTitle().setText(
                "Total fruit consumtion, grouped by gender");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Oranges", "Pears",
                "Grapes", "Bananas"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setAllowDecimals(false);
        yAxis.setMin(0.0);
        yAxis.setTitle(new AxisTitle("Number of fruits"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        ColumnConfig series = new ColumnConfig();
        series.setStacking(Stacking.NORMAL);
        chartConfig.addSeriesConfig(series);

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return '<b>'+ this.x +'</b><br/>'+ this.series.name +': '+ this.y +'<br/>'+ 'Total: '+ this.point.stackTotal;"
                                + "}");
View Full Code Here

        addChart(chart);
    }

    private void showColumnStackedPercent() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN);

        chartConfig.getTitle().setText("Stacked column chart");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Oranges", "Pears",
                "Grapes", "Bananas"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setMin(0.0);
        yAxis.setTitle(new AxisTitle("Total fruit consumption"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        ColumnConfig series = new ColumnConfig();
        series.setStacking(Stacking.PERCENT);
        chartConfig.addSeriesConfig(series);

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return '' + this.series.name +': '+ this.y +' ('+ Math.round(this.percentage) +'%)'; "
                                + "}");
View Full Code Here

        addChart(chart);
    }

    private void showColumnWithRotatedLabels() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN);
        chartConfig.getGeneralChartConfig().setMargin(new Margin());
        chartConfig.getGeneralChartConfig().getMargin().setTop(50);
        chartConfig.getGeneralChartConfig().getMargin().setRight(50);
        chartConfig.getGeneralChartConfig().getMargin().setBottom(100);
        chartConfig.getGeneralChartConfig().getMargin().setLeft(80);

        chartConfig.getTitle().setText("World\'s largest cities per 2008");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Tokyo", "Jakarta", "New York",
                "Seoul", "Manila", "Mumbai", "Sao Paulo", "Mexico City",
                "Dehli", "Osaka", "Cairo", "Kolkata", "Los Angeles",
                "Shanghai", "Moscow", "Beijing", "Buenos Aires", "Guangzhou",
                "Shenzhen", "Istanbul"));
        xAxis.setLabel(new XAxisDataLabel());
        xAxis.getLabel().setRotation(-45);
        xAxis.getLabel().setAlign(HorzAlign.RIGHT);
        xAxis.getLabel()
                .setStyle("{ font: 'normal 13px Verdana, sans-serif' }");
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setMin(0.0);
        yAxis.setTitle(new AxisTitle("Population (millions)"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        chartConfig.setLegend(new Legend(false));

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return '<b>'+ this.x +'</b><br/>'+ 'Population in 2008: '+ $wnd.Highcharts.numberFormat(this.y, 1) + "
                                + " ' millions' " + "}");
View Full Code Here

        addChart(chart);
    }

    private void showAreaWithNegValues() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.AREA);

        chartConfig.getTitle().setText("Area chart with negative values");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Oranges", "Pears",
                "Grapes", "Bananas"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        chartConfig.getCredit().setEnabled(false);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries series = new XYSeries("John");
        series.setSeriesPoints(getPoints(series, 5, 3, 4, 7, 2));
View Full Code Here

        addChart(chart);
    }

    private void showAreaInvertedAxes() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.AREA);
        chartConfig.getGeneralChartConfig().setInverted(true);

        chartConfig.getTitle().setText(
                "Average fruit consumption during one week");
        chartConfig.getSubtitle().setStyle(
                "{ position: 'absolute', right: '0px', bottom: '10px'}");

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

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Monday", "Tuesday", "Wednesday",
                "Thursday", "Friday", "Saturday", "Sunday"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle("Number of units"));
        yAxis.setMin(0.0);
        yAxis.setLabel(new YAxisDataLabel());
        yAxis.getLabel().setFormatterJsFunc(
                "function() {" + " return this.value; " + "}");
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

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

        AreaConfig areaCfg = new AreaConfig();
        areaCfg.setFillOpacity(0.5);
        chartConfig.addSeriesConfig(areaCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries series = new XYSeries("John");
        series.setSeriesPoints(getPoints(series, 3, 4, 3, 5, 4, 10, 12));
View Full Code Here

        addChart(chart);
    }

    private void showAreaWithMissingPoints() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.AREA);
        chartConfig.getGeneralChartConfig().setSpacing(new Spacing());
        chartConfig.getGeneralChartConfig().getSpacing().setBottom(30);

        chartConfig.getTitle().setText("Fruit consumption *");
        chartConfig.getSubtitle().setText(
                "* Jane\'s banana consumption is unknown");
        chartConfig.getSubtitle().setFloating(true);
        chartConfig.getSubtitle().setAlign(HorzAlign.RIGHT);
        chartConfig.getSubtitle().setVertAlign(VertAlign.BOTTOM);
        chartConfig.getSubtitle().setY(15);

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

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("Apples", "Pears", "Oranges",
                "Bananas", "Grapes", "Plums", "Strawberries", "Raspberries"));
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

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

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y;"
                                + "}");

        chartConfig.getCredit().setEnabled(false);

        AreaConfig areaCfg = new AreaConfig();
        areaCfg.setFillOpacity(0.5);
        chartConfig.addSeriesConfig(areaCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries series = new XYSeries("John");
        series.setSeriesPoints(getPoints(series, 0, 1, 4, 4, 5, 2, 3, 7));
View Full Code Here

        addChart(chart);
    }

    private void showAreaStacked() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.AREA);

        chartConfig.getTitle().setText(
                "Historic and Estimated Worldwide Population Growth by Region");
        chartConfig.getSubtitle().setText("Source: Wikipedia.org");

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(Arrays.asList("1750", "1800", "1850", "1900",
                "1950", "1999", "2050"));
        Tick tick = new Tick();
        tick.setPlacement(TickmarkPlacement.ON);
        xAxis.setTick(tick);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle("Billions"));
        yAxis.setLabel(new YAxisDataLabel());
        yAxis.getLabel().setFormatterJsFunc(
                "function() {" + " return this.value / 1000; " + "}");

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

        chartConfig
                .getTooltip()
                .setFormatterJsFunc(
                        "function() {"
                                + " return ''+ this.x +': '+ $wnd.Highcharts.numberFormat(this.y, 0, ',') +' millions';"
                                + "}");

        AreaConfig areaCfg = new AreaConfig();
        areaCfg.setStacking(Stacking.NORMAL);
        areaCfg.setLineColor(new RGB(102, 102, 102));
        areaCfg.setLineWidth(1);

        SymbolMarker marker = new SymbolMarker();
        marker.setLineColor(new RGB(102, 102, 102));
        marker.setLineWidth(1);
        areaCfg.setMarker(marker);

        chartConfig.addSeriesConfig(areaCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries series = new XYSeries("Asia");
        series.setSeriesPoints(getPoints(series, 502, 635, 809, 947, 1402,
View Full Code Here

TOP

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

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.