Package com.invient.vaadin.charts

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


        addChart(chart);
    }

    private void showBarStacked() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.BAR);

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

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

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

        Legend legend = new Legend();
        legend.setBackgroundColor(new RGB(255, 255, 255));
        legend.setReversed(true);
        chartConfig.setLegend(legend);

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

        SeriesConfig seriesCfg = new SeriesConfig();
        seriesCfg.setStacking(Stacking.NORMAL);
        chartConfig.addSeriesConfig(seriesCfg);

        InvientCharts chart = new InvientCharts(chartConfig);

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


        addChart(chart);

    }

    private void showBarBasic() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.BAR);

        chartConfig.getTitle().setText("Historic World Population by Region");
        chartConfig.getSubtitle().setText("Source: Wikipedia.org");

        CategoryAxis xAxisMain = new CategoryAxis();
        List<String> categories = Arrays.asList("Africa", "America", "Asia",
                "Europe", "Oceania");
        xAxisMain.setCategories(categories);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        xAxesSet.add(xAxisMain);
        chartConfig.setXAxes(xAxesSet);

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

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

        BarConfig barCfg = new BarConfig();
        barCfg.setDataLabel(new DataLabel());
        chartConfig.addSeriesConfig(barCfg);

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

        chartConfig.getCredit().setEnabled(false);

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries seriesData = new XYSeries("Year 1800");
        seriesData.setSeriesPoints(getPoints(seriesData, 107, 31, 635, 203, 2));
View Full Code Here

        addChart(chart);

    }

    private void showBarWithNegStack() {
        InvientChartsConfig chartConfig = new InvientChartsConfig();
        chartConfig.getGeneralChartConfig().setType(SeriesType.BAR);

        chartConfig.getTitle().setText(
                "Population pyramid for Germany, midyear 2010");
        chartConfig.getSubtitle().setText("Source: www.census.gov");

        CategoryAxis xAxisMain = new CategoryAxis();
        List<String> categories = Arrays.asList("0-4", "5-9", "10-14", "15-19",
                "20-24", "25-29", "30-34", "35-39", "40-44", "45-49", "50-54",
                "55-59", "60-64", "65-69", "70-74", "75-79", "80-84", "85-89",
                "90-94", "95-99", "100 +");
        xAxisMain.setCategories(categories);
        xAxisMain.setReversed(false);
        LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
        // Opposite axis
        xAxesSet.add(xAxisMain);

        CategoryAxis xAxis = new CategoryAxis();
        xAxis.setCategories(categories);
        xAxis.setOpposite(true);
        xAxis.setReversed(false);
        xAxis.setLinkedTo(xAxisMain);
        xAxesSet.add(xAxis);
        chartConfig.setXAxes(xAxesSet);

        NumberYAxis yAxis = new NumberYAxis();
        yAxis.setTitle(new AxisTitle(""));
        yAxis.setMin(-4000000.0);
        yAxis.setMax(4000000.0);
        yAxis.setLabel(new YAxisDataLabel());
        yAxis.getLabel().setFormatterJsFunc(
                "function() {"
                        + " return (Math.abs(this.value) / 1000000) + 'M';"
                        + " }");

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

        Tooltip tooltip = new Tooltip();
        tooltip.setFormatterJsFunc("function() {"
                + " return '<b>'+ this.series.name +', age '+ this.point.category +'</b><br/>' + "
                + " 'Population: '+ Highcharts.numberFormat(Math.abs(this.point.y), 0); "
                + "}");

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

        InvientCharts chart = new InvientCharts(chartConfig);

        XYSeries seriesData = new XYSeries("Male");
        seriesData.setSeriesPoints(getPoints(seriesData, -1746181, -1884428,
View Full Code Here

        addChart(chart);
    }

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

        chartConfig.getTitle().setText("Monthly Average Rainfall");
        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.setMin(0.0);
        yAxis.setTitle(new AxisTitle("Rainfall (mm)"));
        LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
        yAxesSet.add(yAxis);
        chartConfig.setYAxes(yAxesSet);

        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(100);
        legend.getPosition().setY(70);
        legend.setShadow(true);
        legend.setBackgroundColor(new RGB(255, 255, 255));
        chartConfig.setLegend(legend);

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

        ColumnConfig colCfg = new ColumnConfig();
        colCfg.setPointPadding(0.2);
        colCfg.setBorderWidth(0);
        chartConfig.addSeriesConfig(colCfg);

        InvientCharts chart = new InvientCharts(chartConfig);
        XYSeries seriesData = new XYSeries("Tokyo");
        seriesData.setSeriesPoints(getPoints(seriesData, 49.9, 71.5, 106.4,
                129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4));
View Full Code Here

        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

TOP

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

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.