Class EChartsAxis

java.lang.Object
com.oorian.echarts.options.EChartsAxis
All Implemented Interfaces:
com.oorian.json.Jsonable

public class EChartsAxis extends Object implements com.oorian.json.Jsonable
Represents an axis configuration for cartesian charts.

Axes are fundamental components of charts that use rectangular coordinates. This class supports various axis types and extensive customization options.

EChartsAxis types include:

  • "value" - Numerical axis for continuous data
  • "category" - Category axis for discrete data
  • "time" - Time axis for temporal data
  • "log" - Logarithmic axis

Key features:

  • Customizable range (min/max)
  • Tick and label formatting
  • EChartsGrid lines and split areas
  • EChartsAxis name and positioning
  • Interactive features (pointer, events)

Example usage:


 EChartsAxis xAxis = new EChartsAxis();
 xAxis.setType("category");
 xAxis.setName("Month");
 xAxis.addData("Jan", "Feb", "Mar");
 xAxis.setBoundaryGap(true);
 
Author:
Oorian
See Also:
  • Constructor Details

    • EChartsAxis

      public EChartsAxis()
      Constructs a new EChartsAxis with an empty data list.
  • Method Details

    • setType

      public void setType(String type)
      Sets the axis type.
      Parameters:
      type - the axis type ("value", "category", "time", "log")
    • setName

      public void setName(String name)
      Sets the axis name.
      Parameters:
      name - the axis name
    • setNameLocation

      public void setNameLocation(String nameLocation)
      Sets the axis name location.
      Parameters:
      nameLocation - the name location
    • setNameTextStyle

      public void setNameTextStyle(EChartsTextStyle nameTextStyle)
      Sets the axis name text style.
      Parameters:
      nameTextStyle - the text style for the axis name
    • setData

      public void setData(List<String> data)
      Sets the data list for this axis.
      Parameters:
      data - the data list to set
    • setBoundaryGap

      public void setBoundaryGap(Boolean boundaryGap)
      Sets the boundary gap option.
      Parameters:
      boundaryGap - whether to have a boundary gap
    • setMin

      public void setMin(Number min)
      Sets the minimum value of the axis.

      Use "dataMin" to automatically use the minimum value from data.

      Parameters:
      min - the minimum value
    • setMax

      public void setMax(Number max)
      Sets the maximum value of the axis.

      Use "dataMax" to automatically use the maximum value from data.

      Parameters:
      max - the maximum value
    • setAxisLine

      public void setAxisLine(EChartsAxisLine axisLine)
      Sets the axis line configuration.
      Parameters:
      axisLine - the axis line configuration
    • setAxisTick

      public void setAxisTick(EChartsAxisTick axisTick)
      Sets the axis tick configuration.
      Parameters:
      axisTick - the axis tick configuration
    • setAxisLabel

      public void setAxisLabel(EChartsAxisLabel axisLabel)
      Sets the axis label configuration.
      Parameters:
      axisLabel - the axis label configuration
    • setSplitLine

      public void setSplitLine(EChartsSplitLine splitLine)
      Sets the split line configuration.
      Parameters:
      splitLine - the split line configuration
    • setSplitArea

      public void setSplitArea(EChartsSplitArea splitArea)
      Sets the split area configuration.
      Parameters:
      splitArea - the split area configuration
    • setAxisPointer

      public void setAxisPointer(EChartsAxisPointer axisPointer)
      Sets the axis pointer configuration.
      Parameters:
      axisPointer - the axis pointer configuration
    • setAlignTicks

      public void setAlignTicks(Boolean alignTicks)
      Sets the align ticks option.
      Parameters:
      alignTicks - whether to align ticks
    • getType

      public String getType()
      Gets the axis type.
      Returns:
      the axis type ("value", "category", "time", "log")
    • getName

      public String getName()
      Gets the axis name.
      Returns:
      the axis name
    • getNameLocation

      public String getNameLocation()
      Gets the axis name location.
      Returns:
      the name location
    • getNameTextStyle

      public EChartsTextStyle getNameTextStyle()
      Gets the axis name text style.
      Returns:
      the text style for the axis name
    • getData

      public List<String> getData()
      Gets the data list for this axis.
      Returns:
      the data list
    • getBoundaryGap

      public Boolean getBoundaryGap()
      Gets the boundary gap option.
      Returns:
      whether there is a boundary gap
    • getMin

      public Number getMin()
      Gets the minimum value of the axis.
      Returns:
      the minimum value
    • getMax

      public Number getMax()
      Gets the maximum value of the axis.
      Returns:
      the maximum value
    • getAxisLine

      public EChartsAxisLine getAxisLine()
      Gets the axis line configuration.
      Returns:
      the axis line configuration
    • getAxisTick

      public EChartsAxisTick getAxisTick()
      Gets the axis tick configuration.
      Returns:
      the axis tick configuration
    • getAxisLabel

      public EChartsAxisLabel getAxisLabel()
      Gets the axis label configuration.
      Returns:
      the axis label configuration
    • getSplitLine

      public EChartsSplitLine getSplitLine()
      Gets the split line configuration.
      Returns:
      the split line configuration
    • getSplitArea

      public EChartsSplitArea getSplitArea()
      Gets the split area configuration.
      Returns:
      the split area configuration
    • getAxisPointer

      public EChartsAxisPointer getAxisPointer()
      Gets the axis pointer configuration.
      Returns:
      the axis pointer configuration
    • getAlignTicks

      public Boolean getAlignTicks()
      Gets the align ticks option.
      Returns:
      whether ticks are aligned
    • addData

      public void addData(String item)
      Adds a data item to this axis.

      Typically used for category axes to define the categories.

      Parameters:
      item - the data item to add
    • initFromJson

      public void initFromJson(com.oorian.json.JsonValue json)
      Specified by:
      initFromJson in interface com.oorian.json.Jsonable
    • toJsonValue

      public com.oorian.json.JsonValue toJsonValue()
      Specified by:
      toJsonValue in interface com.oorian.json.Jsonable