All Downloads are FREE. Search and download functionalities are using the official Maven repository.

visualizations.BarChart Maven / Gradle / Ivy

The newest version!
package visualizations;


import tech.tablesaw.api.Table;
import tech.tablesaw.plotly.Plot;
import tech.tablesaw.plotly.api.HorizontalBarPlot;
import tech.tablesaw.plotly.api.VerticalBarPlot;

/**
 * Class that plots basic Bar charts.
 */
public class BarChart {

    public class BarChartOptions {
        public String chartTitle;
        public String groupColName;
        public String numberColName;

    }

    /**
     * Plots basic bar chart given
     * chart title, data set in Table format,
     * x-axis name, y-axis name.
     */
    public static void plotBar(BarChartOptions options, Table data) {

        Plot.show(VerticalBarPlot.create(options.chartTitle, data, options.groupColName, options.numberColName));
    }

    /**
     * Plots horizontal bar chart given
     * chart title, data set in Table format,
     * x-axis name, y-axis name.
     */
    public static void plotHorizontalBar(BarChartOptions options, Table data) {

        Plot.show(HorizontalBarPlot.create(options.chartTitle, data, options.groupColName, options.numberColName));

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy