ParallelCoordinates.SelectedAxis

Syntax

SelectedAxis: PP.Ui.PCAxis;

Description

The SelectedAxis property determines selected axis of the chart.

Comments

Use JSON or the setSelectedAxis method to set the property value, and the getSelectedAxis method to get the property value.

Example

Executing the example requires the ParallelCoordinates component named coord (see Example of Creating the ParallelCoordinates Component). Define settings for mapping chart data with colors of its lines, define type of this mapping, next disable selection for the first axis and allow selection for the second axis:

// Create settings for mapping chart data with lines colors
var colorMap = new PP.DataMapping({
    DataSource: dataSource,
    Type: PP.DataMappingType.Scale,
    Scale: new PP.ScaleBase({
        Values: [50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0],
        Items: ["#001900", "#003200", "#004B00", "#006400",
            "#007D00", "#009600", "#00AF00", "#00C800", "#00E100"],
        EnableEquality: "false",
        NoData: "#CCCCCC",
        TypeArguments: "Brush"
    })
});
var visual = new PP.ColorVisual({
    ColorMapping: colorMap
});
// Set options for data mapping
coord.setVisuals([visual]);
// check if an object for mapping visualizer data is available
if (coord.getColorVisual() !== undefined) {
    //console.log("Object for mapping visualizer data is specified");
    console.log("Data mapping type: %s", coord.getColorVisual().getColorMapping().getType());
}
// Selects a chart axis
function selectAxis(index) {
    // Get chart axes
    var axes = coord.getAxes();
    // Try to select a chart axis
    coord.setSelectedAxis(axes[index]);
    // Redraw the chart
    coord.draw();
    if(coord.getSelectedAxis()) {
        // Get ID of the selected chart axis
        console.log("Axis with the index %s is selected", index);
    } else {
        console.log("Axis with the index %s is not selected", index);
    }    
}
// Disable chart axes selection
coord.setAxisSelectionEnabled(false);
// Try to select the first axis in the chart
selectAxis(0);
// Allow chart axes selection
coord.setAxisSelectionEnabled(true);
// Try to select the first axis in the chart
selectAxis(1);

After executing the example settings are defined for mapping chart data with colors of its lines. Selection is disabled for the chart first axis and allowed for the second axis:

Corresponding notifications are displayed in the browser console:

Data mapping type: Scale

Axis with the index 0 is not selected

Axis with the index 1 is selected

See also:

ParallelCoordinates