Class ApexChart

java.lang.Object
com.oorian.html.Element<ApexChart>
com.oorian.apexcharts.ApexChartsComponent<ApexChart>
com.oorian.apexcharts.ApexChart
Direct Known Subclasses:
ApexAreaChart, ApexBarChart, ApexBoxPlotChart, ApexBubbleChart, ApexCandlestickChart, ApexColumnChart, ApexDonutChart, ApexHeatmapChart, ApexLineChart, ApexPieChart, ApexPolarAreaChart, ApexRadarChart, ApexRadialBarChart, ApexRangeAreaChart, ApexRangeBarChart, ApexScatterChart, ApexTreemapChart

public class ApexChart extends ApexChartsComponent<ApexChart>
ApexCharts chart component. Supports all ApexCharts chart types: line, area, bar, column, pie, donut, radialBar, scatter, bubble, heatmap, treemap, radar, polarArea, rangeBar, rangeArea, candlestick, boxPlot, and funnel.
  • Field Details

  • Constructor Details

    • ApexChart

      public ApexChart()
      Creates a new chart with the default type (line).
    • ApexChart

      public ApexChart(String type)
      Creates a new chart with the specified type.
      Parameters:
      type - The chart type.
  • Method Details

    • setType

      public ApexChart setType(String type)
      Sets the chart type.
      Parameters:
      type - The chart type (use TYPE_* constants).
      Returns:
      This chart for method chaining.
    • setTitle

      public ApexChart setTitle(String title)
      Sets the chart title.
      Parameters:
      title - The chart title.
      Returns:
      This chart for method chaining.
    • setTitleAlign

      public ApexChart setTitleAlign(String align)
      Sets the title alignment.
      Parameters:
      align - The alignment ("left", "center", "right").
      Returns:
      This chart for method chaining.
    • setChartHeight

      public ApexChart setChartHeight(int height)
      Sets the chart height in pixels.
      Parameters:
      height - The height in pixels.
      Returns:
      This chart for method chaining.
    • setChartWidth

      public ApexChart setChartWidth(int width)
      Sets the chart width in pixels.
      Parameters:
      width - The width in pixels.
      Returns:
      This chart for method chaining.
    • setCurve

      public ApexChart setCurve(String curve)
      Sets the curve type for line/area charts.
      Parameters:
      curve - The curve type (use CURVE_* constants).
      Returns:
      This chart for method chaining.
    • setStacked

      public ApexChart setStacked(boolean stacked)
      Sets whether the chart is stacked.
      Parameters:
      stacked - True for stacked, false for grouped.
      Returns:
      This chart for method chaining.
    • setStackedPercent

      public ApexChart setStackedPercent(boolean percent)
      Sets whether the stacked chart shows percentages.
      Parameters:
      percent - True for 100% stacked.
      Returns:
      This chart for method chaining.
    • setToolbar

      public ApexChart setToolbar(boolean show)
      Sets whether to show the toolbar.
      Parameters:
      show - True to show toolbar.
      Returns:
      This chart for method chaining.
    • setZoom

      public ApexChart setZoom(boolean enabled)
      Sets whether zoom is enabled.
      Parameters:
      enabled - True to enable zoom.
      Returns:
      This chart for method chaining.
    • setAnimations

      public ApexChart setAnimations(boolean enabled)
      Sets whether animations are enabled.
      Parameters:
      enabled - True to enable animations.
      Returns:
      This chart for method chaining.
    • setDataLabels

      public ApexChart setDataLabels(boolean show)
      Sets whether to show data labels on the chart.
      Parameters:
      show - True to show data labels.
      Returns:
      This chart for method chaining.
    • setLegend

      public ApexChart setLegend(boolean show)
      Sets whether to show the legend.
      Parameters:
      show - True to show legend.
      Returns:
      This chart for method chaining.
    • setLegendPosition

      public ApexChart setLegendPosition(String position)
      Sets the legend position.
      Parameters:
      position - The position ("top", "right", "bottom", "left").
      Returns:
      This chart for method chaining.
    • setGrid

      public ApexChart setGrid(boolean show)
      Sets whether to show the grid.
      Parameters:
      show - True to show grid.
      Returns:
      This chart for method chaining.
    • setXAxisTitle

      public ApexChart setXAxisTitle(String title)
      Sets the X-axis title.
      Parameters:
      title - The axis title.
      Returns:
      This chart for method chaining.
    • setYAxisTitle

      public ApexChart setYAxisTitle(String title)
      Sets the Y-axis title.
      Parameters:
      title - The axis title.
      Returns:
      This chart for method chaining.
    • setCategories

      public ApexChart setCategories(String... categories)
      Sets the categories (X-axis labels).
      Parameters:
      categories - The categories.
      Returns:
      This chart for method chaining.
    • addSeries

      public ApexChart addSeries(ApexSeries series)
      Adds a data series to the chart.
      Parameters:
      series - The series to add.
      Returns:
      This chart for method chaining.
    • setColors

      public ApexChart setColors(String... colors)
      Sets the chart colors.
      Parameters:
      colors - The colors (CSS color values).
      Returns:
      This chart for method chaining.
    • setPieData

      public ApexChart setPieData(String[] labels, Number[] values)
      Sets pie/donut chart data with labels.
      Parameters:
      labels - The labels.
      values - The values.
      Returns:
      This chart for method chaining.
    • setFunnel

      public ApexChart setFunnel(boolean funnel)
      Sets whether to display the chart as a funnel. Used with TYPE_BAR to create funnel/pyramid charts.
      Parameters:
      funnel - True for funnel mode.
      Returns:
      This chart for method chaining.
    • setCandlestickColors

      public ApexChart setCandlestickColors(String upColor, String downColor)
      Sets the candlestick chart colors for upward and downward movements.
      Parameters:
      upColor - The color for upward (bullish) candles.
      downColor - The color for downward (bearish) candles.
      Returns:
      This chart for method chaining.
    • setCandlestickWickUseFillColor

      public ApexChart setCandlestickWickUseFillColor(boolean useFillColor)
      Sets whether candlestick wicks should use the fill color.
      Parameters:
      useFillColor - True to use fill color for wicks.
      Returns:
      This chart for method chaining.
    • setBoxPlotColors

      public ApexChart setBoxPlotColors(String upperColor, String lowerColor)
      Sets the boxplot chart colors for upper and lower quartile ranges.
      Parameters:
      upperColor - The color for the upper quartile range.
      lowerColor - The color for the lower quartile range.
      Returns:
      This chart for method chaining.
    • setHeatmapDistributed

      public ApexChart setHeatmapDistributed(boolean distributed)
      Sets whether heatmap values are distributed (each cell has its own color).
      Parameters:
      distributed - True for distributed coloring.
      Returns:
      This chart for method chaining.
    • setHeatmapEnableShades

      public ApexChart setHeatmapEnableShades(boolean enableShades)
      Sets whether heatmap shades are enabled.
      Parameters:
      enableShades - True to enable shades.
      Returns:
      This chart for method chaining.
    • setHeatmapColorScale

      public ApexChart setHeatmapColorScale(String minColor, String maxColor)
      Sets the heatmap color scale range.
      Parameters:
      minColor - The color for minimum values.
      maxColor - The color for maximum values.
      Returns:
      This chart for method chaining.
    • setTreemapDistributed

      public ApexChart setTreemapDistributed(boolean distributed)
      Sets whether treemap values are distributed (each cell has its own color).
      Parameters:
      distributed - True for distributed coloring.
      Returns:
      This chart for method chaining.
    • setTreemapEnableShades

      public ApexChart setTreemapEnableShades(boolean enableShades)
      Sets whether treemap shades are enabled.
      Parameters:
      enableShades - True to enable shades.
      Returns:
      This chart for method chaining.
    • setStrokeWidth

      public ApexChart setStrokeWidth(int width)
      Sets the stroke width for line-based charts.
      Parameters:
      width - The stroke width in pixels.
      Returns:
      This chart for method chaining.
    • setStrokeLineCap

      public ApexChart setStrokeLineCap(String lineCap)
      Sets the stroke line cap style.
      Parameters:
      lineCap - The line cap style ("butt", "round", "square").
      Returns:
      This chart for method chaining.
    • setForegroundColor

      public ApexChart setForegroundColor(String color)
      Sets the foreground color for all text elements (axes, legend, labels). Useful for dark-themed charts.
      Parameters:
      color - The CSS color value.
      Returns:
      This chart for method chaining.
    • setXAxisLabelColor

      public ApexChart setXAxisLabelColor(String color)
      Sets the X-axis label color.
      Parameters:
      color - The CSS color value.
      Returns:
      This chart for method chaining.
    • setYAxisLabelColor

      public ApexChart setYAxisLabelColor(String color)
      Sets the Y-axis label color.
      Parameters:
      color - The CSS color value.
      Returns:
      This chart for method chaining.
    • setLegendLabelColor

      public ApexChart setLegendLabelColor(String color)
      Sets the legend label color.
      Parameters:
      color - The CSS color value.
      Returns:
      This chart for method chaining.
    • updateSeries

      public void updateSeries(ApexSeries... newSeries)
      Updates the chart series data dynamically. Use this method to update the chart with new data after it has been rendered.
      Parameters:
      newSeries - The new series data.
    • updateSeries

      public void updateSeries(boolean animate, ApexSeries... newSeries)
      Updates the chart series data dynamically with animation control.
      Parameters:
      animate - Whether to animate the update.
      newSeries - The new series data.
    • updatePieData

      public void updatePieData(Number... values)
      Updates pie/donut/radialBar chart data dynamically.
      Parameters:
      values - The new data values.
    • updatePieData

      public void updatePieData(boolean animate, Number... values)
      Updates pie/donut/radialBar chart data dynamically with animation control.
      Parameters:
      animate - Whether to animate the update.
      values - The new data values.
    • initialize

      protected void initialize()
      Overrides:
      initialize in class com.oorian.html.Element<ApexChart>