Class CjBarChart

java.lang.Object
com.oorian.html.Element<CjChart>

public class CjBarChart extends CjChart
Bar chart component for Chart.js.

Bar charts are used to display data as rectangular bars with lengths proportional to the values they represent. By default, bars are vertical. Use setHorizontal(boolean) to create horizontal bar charts.

Basic Usage:


 CjBarChart chart = new CjBarChart()
     .setLabels("Q1", "Q2", "Q3", "Q4")
     .addDataset(new CjDataset("Revenue")
         .setData(12000, 19000, 15000, 25000)
         .setBackgroundColor("rgba(54, 162, 235, 0.5)"))
     .setTitle("Quarterly Revenue");
 
See Also:
  • Constructor Details

    • CjBarChart

      public CjBarChart()
      Creates a new vertical bar chart.
  • Method Details

    • setHorizontal

      public CjBarChart setHorizontal(boolean horizontal)
      Sets whether the bar chart should be horizontal.
      Parameters:
      horizontal - True for horizontal bars, false for vertical bars.
      Returns:
      This chart for method chaining.