Setting of axis limits of your chart using Linear Axis Maps

How can I set the axis limits on my chart using specific values that I chose?

Step-by-step guide

Below are several examples of how to manually set the limits of an axis:
1) To set both the start and end values, create a LinearAxisMap and then call the setStartValue() and setEndValue() methods

LinearAxisMap yAxisMapStartEnd = new LinearAxisMap();
yAxisMapStartEnd.setStartValue(0);
yAxisMapStartEnd.setEndValue(200);

2) If you just want to set the start value and have an auto-scaled end value, then create a LinearAxisMap and connect it to a field source (so it can determine the end value) and then call the setStartValue() method.

LinearAxisMap yAxisMapStartOnly = new LinearAxisMap();
yAxisMapStartOnly.connectInputField(columnDataToScatter.getOutputField());
yAxisMapStartOnly.setArrayIndex(1);
yAxisMapStartOnly.setStartValue(10);

3) If you just want to set the end value and have an auto-scaled start value, use the same process as the previous example but call the setEndValue() method

LinearAxisMap yAxisMapEndOnly = new LinearAxisMap();
yAxisMapEndOnly.connectInputField(columnDataToScatter.getOutputField());
yAxisMapEndOnly.setArrayIndex(1);
yAxisMapEndOnly.setEndValue(200);

4) A component that is useful when you have multiple series in a single domain is called CombineAxisMaps. It will combine the extents of all the input axis maps.

LinearAxisMap yAxisMap1 = new LinearAxisMap();
yAxisMap1.connectInputField(columnDataToScatter.getOutputField());
yAxisMap1.setArrayIndex(1);

LinearAxisMap yAxisMap2 = new LinearAxisMap();
yAxisMap2.connectInputField(columnDataToScatter.getOutputField());
yAxisMap2.setArrayIndex(2);

CombineAxisMaps combineYAxisMaps = new CombineAxisMaps();
combineYAxisMaps.addAxisMap(yAxisMap1.getOutputAxisMap());
combineYAxisMaps.addAxisMap(yAxisMap2.getOutputAxisMap());

For all these examples you need to connect the new axis map to the appropriate domain axis map method. For example:
domain.connectYAxisMap( yAxisMapStartEnd.getOutputAxisMap() );

 

@Copyright 1991-2019 Advanced Visual Systems, Inc.