getXAxis();
The getXAxis method returns category axis for the chart data series.
The method returns value of the PP.Ui.ChartCanvasAxis type.
To execute the example, the HTML page must contain the Chart component named chart (see Example of Creating a Histogram). Get chart data series, show value of one of its items, next get information on the category axis and value axis used by the data series:
var serieNumber = 0; // Get data series var serie = chart.getSeries()[serieNumber]; // Get the number of data series items var count = serie.getPoints().length; // Get the last item in the data series var point = serie.getPoint(count - 1); // Show value of the last item in the data series console.log("Series: " + serieNumber + " item: " + point.getIndex() + " value: " + point.getY()); // Show message informing if the chart category axis is inverted var xAxis = serie.getXAxis(); var isXAxisInverted = xAxis.getInverted() ? "inverted" : "not inverted"; console.log("Category axis in the chart is " + isXAxisInverted); // Show message informing if the value axis is primary var yAxis = serie.getYAxis(); var isYAxisPrimary = yAxis.getPrimary() ? "primary" : "secondary"; console.log("Values of the " + isYAxisPrimary + " chart axis are used");
After executing the example the browser console displays value for one of the chart series items, and also whether the category axis is inverted and whether values of primary axis were used to plot the data series:
Series: 0 item: 4 value: -30
Category axis in the chart is not inverted
Values of the primary chart axis are used
See also: