The X axis is usually the horizontal axis and contains category axis labels.
EasyXLS™ library allows setting the category axis labels, axis options and formatting the axis.
The axis formatting is formed by number format, font settings, fill settings, line style settings, line color settings, shadow settings, 3D-format and alignment settings.
' Format category X axis
xlsChart.easy_getCategoryXAxis().setLineColor(Color.SteelBlue)
xlsChart.easy_getCategoryXAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getCategoryXAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE)
xlsChart.easy_getCategoryXAxis().setForeground(Color.Red)
C++// Format category X axis
xlsChart->easy_getCategoryXAxis()->setLineColor(COLOR_STEELBLUE);
xlsChart->easy_getCategoryXAxis()->setLineStyle(CHART_LINE_STYLE_MEDIUM_GRAY);
xlsChart->easy_getCategoryXAxis()->setLineWeight(CHART_LINE_WEIGHT_WIDE);
xlsChart->easy_getCategoryXAxis()->setForeground(COLOR_RED);
Click here to see Continuous Code ListingC++.NET// Format category X axis
xlsChart->easy_getCategoryXAxis()->setLineColor(Color::SteelBlue);
xlsChart->easy_getCategoryXAxis()->setLineStyle(Chart::LINE_STYLE_MEDIUM_GRAY);
xlsChart->easy_getCategoryXAxis()->setLineWeight(Chart::LINE_WEIGHT_WIDE);
xlsChart->easy_getCategoryXAxis()->setForeground(Color::Red);
Click here to see Continuous Code Listing
// Format category X axis
xlsChart.easy_getCategoryXAxis().setLineColor(Color.lightGray);
xlsChart.easy_getCategoryXAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY);
xlsChart.easy_getCategoryXAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE);
xlsChart.easy_getCategoryXAxis().setForeground(Color.red);
.NET:// Format category X axis
$xlsChart->easy_getCategoryXAxis()->setLineColor((int)$COLOR_STEELBLUE);
$xlsChart->easy_getCategoryXAxis()->setLineStyle($CHART_LINE_STYLE_MEDIUM_GRAY);
$xlsChart->easy_getCategoryXAxis()->setLineWeight($CHART_LINE_WEIGHT_WIDE);
$xlsChart->easy_getCategoryXAxis()->setForeground((int)$COLOR_RED);
Click here to see Continuous Code ListingJava:// Format chart X axis
$xlsXAxis = $xlsChart->easy_getCategoryXAxis();
$xlsXAxis->getLineColorFormat()->setLineColor(java("java.awt.Color")->LIGHTGRAY);
$xlsXAxis->getLineStyleFormat()->setDashType($LINESTYLEFORMAT_DASH_TYPE_DASH_DOT);
$xlsXAxis->getLineStyleFormat()->setWidth(0.25);
$xlsXAxis->getFontFormat()->setForeground(java("java.awt.Color")->RED);
Click here to see Continuous Code Listing
' Format category X axis
xlsChart.easy_getCategoryXAxis().setLineColor(CLng(COLOR_STEELBLUE))
xlsChart.easy_getCategoryXAxis().setLineStyle(CHART_LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getCategoryXAxis().setLineWeight(CHART_LINE_WEIGHT_WIDE)
xlsChart.easy_getCategoryXAxis().setForeground(CLng(COLOR_RED))
<!-- Format category X axis --><cfset xlsChart.easy_getCategoryXAxis().setLineColor(Color.LightGray)><cfset xlsChart.easy_getCategoryXAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY)><cfset xlsChart.easy_getCategoryXAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE)><cfset xlsChart.easy_getCategoryXAxis().setForeground(Color.Red)>
.NET:# Format chart X axis
xlsXAxis = xlsChart.easy_getCategoryXAxis()
xlsXAxis.getLineColorFormat().setLineColor(Color.SteelBlue)
xlsXAxis.getLineStyleFormat().setDashType(LineStyleFormat.DASH_TYPE_DASH_DOT)
xlsXAxis.getLineStyleFormat().setWidth(0.25)
xlsXAxis.getFontFormat().setForeground(Color.Red)
Click here to see Continuous Code ListingJava:# Format chart X axis
xlsXAxis = xlsChart.easy_getCategoryXAxis()
xlsXAxis.getLineColorFormat().setLineColor(gateway.jvm.Color.lightGray)
xlsXAxis.getLineStyleFormat().setDashType(gateway.jvm.LineStyleFormat.DASH_TYPE_DASH_DOT)
xlsXAxis.getLineStyleFormat().setWidth(0.25)
xlsXAxis.getFontFormat().setForeground(gateway.jvm.Color.red)
Click here to see Continuous Code Listing
The screen shot provides an example of a cylinder chart. The X axis is formatted: line-color (steel blue), line-style (dash-dot-dot), line-width and foreground (red).
Category X axis labels
The category axis labels can be set using ExcelChart.easy_setCategoryXAxisLabels method. Also, as showed in the above tutorial, the axis labels are automatically built from the data source when the chart sheet is added to the workbook.
The axis can have an assigned title that explains the meaning of the axis using ExcelAxis.setAxisTitle method. The title includes the name of the axis and formatting options.
EasyXLS library allows you to set different axis options like:
- Interval between tick marks - Interval between labels - Categories in reverse order - Major tick mark type - Minor tick mark type - Axis labels settings - Vertical axis crosses settings - Position axis settings
The goal can be achieved using various methods from ExcelAxis class.
Axis number format
EasyXLS allows you to set the number format of the axis labels by means of ExcelAxis.setNumberFormat method. The number format can also be linked to the number format of the data source.
Axis font settings
EasyXLS allows you to set the font appearance of the axis through the usage of FontDrawingObject.getFontFormat method that is available in ExcelAxis class because of the class inheritance. The supported font settings are: - Font name - Font style (bold, italic, regular) - Font size - Font color - Font underline style - Font effect (strikethrough, superscript, subscript, offset, small caps)
Axis fill formatting
EasyXLS allows you to set the background appearance of the chart axis through the usage of FillDrawingObject.getFillFormat method that is available in ExcelAxis class because of the class inheritance.
The supported fill options are: - No fill - Solid fill (axis color, axis transparency) - Gradient fill - Picture and texture fill - Automatic
Axis line color formatting
EasyXLS allows you to set the line color appearance of the chart axis through the usage of LineDrawingObject.getLineColorFormat method that is available in ExcelAxis class because of the class inheritance.
The supported line color options are: - No line - Solid line (axis line color) - Gradient line - Automatic
Axis line style formatting
EasyXLS allows you to set the line style of the chart axis through the usage of LineDrawingObject.getLineStyleFormat method that is available in ExcelAxis class because of the class inheritance.
The supported border style options are: - Line width - Compound type - Dash type - Cap type - Join type - Arrow settings
Axis shadow formatting
EasyXLS allows you to set the shadow appearance of the chart axis through the usage of LineDrawingObject.getShadowFormat method that is available in ExcelAxis class because of the class inheritance.
The supported shadow options are: - Preset shadows - Shadow color - Transparency, size, blur, angle and distance
Axis 3D formatting
EasyXLS allows you to set the 3D appearance of the chart axis through the usage of EffectDrawingObject.get3DFormat method that is available in ExcelAxis class because of the class inheritance.
The supported 3D options are:
- Surface settings (material and lighting)
Axis alignment formatting
EasyXLS allows you to set the alignment of the chart axis through the usage of AlignDrawingObject.getAlignmentFormat method that is available in ExcelAxis class because of the class inheritance.
The supported alignment options are: - Horizontal alignment - Text direction - Rotation of the text