The Y axis is usually the vertical axis and displays the values of the chart.
EasyXLS™ library allows setting the chart values, 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 value Y axis
ExcelAxis xlsYAxis = xlsChart.easy_getCategoryYAxis();
xlsYAxis.getLineColorFormat().setLineColor(Color.SteelBlue);
xlsYAxis.getLineStyleFormat().setDashType(LineStyleFormat.DASH_TYPE_LONG_DASH);
xlsYAxis.getLineStyleFormat().setWidth(0.25f);
xlsYAxis.getFontFormat().setForeground(Color.Blue);
' Format value Y axis
xlsChart.easy_getValueYAxis().setLineColor(Color.SteelBlue)
xlsChart.easy_getValueYAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getValueYAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE)
xlsChart.easy_getValueYAxis().setForeground(Color.Blue)
C++// Format value Y axis
xlsChart->easy_getValueYAxis()->setLineColor(COLOR_STEELBLUE);
xlsChart->easy_getValueYAxis()->setLineStyle(CHART_LINE_STYLE_MEDIUM_GRAY);
xlsChart->easy_getValueYAxis()->setLineWeight(CHART_LINE_WEIGHT_WIDE);
xlsChart->easy_getValueYAxis()->setForeground(COLOR_BLUE);
Click here to see Continuous Code ListingC++.NET// Format value Y axis
xlsChart->easy_getValueYAxis()->setLineColor(Color::SteelBlue);
xlsChart->easy_getValueYAxis()->setLineStyle(Chart::LINE_STYLE_MEDIUM_GRAY);
xlsChart->easy_getValueYAxis()->setLineWeight(Chart::LINE_WEIGHT_WIDE);
xlsChart->easy_getValueYAxis()->setForeground(Color::Blue);
Click here to see Continuous Code Listing
// Format value Y axis
xlsChart.easy_getValueYAxis().setLineColor(Color.lightGray);
xlsChart.easy_getValueYAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY);
xlsChart.easy_getValueYAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE);
xlsChart.easy_getValueYAxis().setForeground(Color.blue);
.NET:// Format value Y axis
$xlsChart->easy_getValueYAxis()->setLineColor((int)$COLOR_STEELBLUE);
$xlsChart->easy_getValueYAxis()->setLineStyle($CHART_LINE_STYLE_MEDIUM_GRAY);
$xlsChart->easy_getValueYAxis()->setLineWeight($CHART_LINE_WEIGHT_WIDE);
$xlsChart->easy_getValueYAxis()->setForeground((int)$COLOR_BLUE);
Click here to see Continuous Code ListingJava:// Format chart Y axis
$xlsYAxis = $xlsChart->easy_getValueYAxis();
$xlsYAxis->getLineColorFormat()->setLineColor(java("java.awt.Color")->LIGHTGRAY);
$xlsYAxis->getLineStyleFormat()->setDashType($LINESTYLEFORMAT_DASH_TYPE_LONG_DASH);
$xlsYAxis->getLineStyleFormat()->setWidth(0.25);
$xlsYAxis->getFontFormat()->setForeground(java("java.awt.Color")->BLUE);
Click here to see Continuous Code Listing
' Format value Y axis
xlsChart.easy_getValueYAxis().setLineColor(CLng(COLOR_STEELBLUE))
xlsChart.easy_getValueYAxis().setLineStyle(CHART_LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getValueYAxis().setLineWeight(CHART_LINE_WEIGHT_WIDE)
xlsChart.easy_getValueYAxis().setForeground(CLng(COLOR_BLUE))
' Format value Y axis
xlsChart.easy_getValueYAxis().setLineColor (CLng(Color.COLOR_STEELBLUE))
xlsChart.easy_getValueYAxis().setLineStyle (Chart.CHART_LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getValueYAxis().setLineWeight (Chart.CHART_LINE_WEIGHT_WIDE)
xlsChart.easy_getValueYAxis().setForeground (CLng(Color.COLOR_BLUE))
' Format value Y axis
xlsChart.easy_getValueYAxis().setLineColor (CLng(SteelBlue))
xlsChart.easy_getValueYAxis().setLineStyle (LINE_STYLE_MEDIUM_GRAY)
xlsChart.easy_getValueYAxis().setLineWeight (LINE_WEIGHT_WIDE)
xlsChart.easy_getValueYAxis().setForeground (CLng(Blue))
<!-- Format value Y axis --><cfset xlsChart.easy_getValueYAxis().setLineColor(Color.LightGray)><cfset xlsChart.easy_getValueYAxis().setLineStyle(Chart.LINE_STYLE_MEDIUM_GRAY)><cfset xlsChart.easy_getValueYAxis().setLineWeight(Chart.LINE_WEIGHT_WIDE)><cfset xlsChart.easy_getValueYAxis().setForeground(Color.Blue)>
.NET:# Format chart Y axis
xlsYAxis = xlsChart.easy_getValueYAxis()
xlsYAxis.getLineColorFormat().setLineColor(Color.SteelBlue)
xlsYAxis.getLineStyleFormat().setDashType(LineStyleFormat.DASH_TYPE_LONG_DASH)
xlsYAxis.getLineStyleFormat().setWidth(0.25)
xlsYAxis.getFontFormat().setForeground(Color.Blue)
Click here to see Continuous Code ListingJava:# Format chart Y axis
xlsYAxis = xlsChart.easy_getValueYAxis()
xlsYAxis.getLineColorFormat().setLineColor(gateway.jvm.Color.lightGray)
xlsYAxis.getLineStyleFormat().setDashType(gateway.jvm.LineStyleFormat.DASH_TYPE_LONG_DASH)
xlsYAxis.getLineStyleFormat().setWidth(0.25)
xlsYAxis.getFontFormat().setForeground(gateway.jvm.Color.blue)
Click here to see Continuous Code Listing
The screen shot provides an example of a cylinder chart. The Y axis is formatted: line-color (steel blue), line-style (medium gray), line-width and foreground (blue).
Y axis values
The values for Y axis can be set through series values using ExcelChart.easy_addSeries method. Also, as showed in the above tutorial, the series can be 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