Search in sources :

Example 1 with XYMultipleSeriesRenderer

use of com.codename1.charts.renderers.XYMultipleSeriesRenderer in project CodenameOne by codenameone.

the class ChartComponent method setPanLimits.

/**
 * Sets the pan limits if panning is enabled.
 * @param minX The minimum X-axis value for panning.
 * @param maxX The maximum X-axis value for panning.
 * @param minY The minimum Y-axis value for panning.
 * @param maxY The maximum Y-axis value for panning.
 */
public void setPanLimits(double minX, double maxX, double minY, double maxY) {
    if (chart instanceof XYChart) {
        XYChart xyChart = (XYChart) chart;
        XYMultipleSeriesRenderer r = xyChart.getRenderer();
        r.setPanLimits(new double[] { minX, maxX, minY, maxY });
    } else {
        throw new RuntimeException("setPanLimits() only supported for XYCharts");
    }
}
Also used : XYMultipleSeriesRenderer(com.codename1.charts.renderers.XYMultipleSeriesRenderer) XYChart(com.codename1.charts.views.XYChart)

Example 2 with XYMultipleSeriesRenderer

use of com.codename1.charts.renderers.XYMultipleSeriesRenderer in project CodenameOne by codenameone.

the class ChartComponent method setZoomLimits.

/**
 * Sets the zoom limits.
 *
 * <p><strong>NOTE: This method is only applicable when showing an {@link XYChart }</strong>  It will throw a
 * RuntimeException if called while a different kind of chart is being shown.</p>
 *
 * @param minRangeX The minimum distance from {@link XYMultipleSeriesRenderer#getXAxisMin() } to
 * {@link XYMultipleSeriesRenderer#getXAxisMax() } that can be achieved by zooming in.  {@literal 0} means no limit.
 * @param maxRangeX The maximum distance from {@link XYMultipleSeriesRenderer#getXAxisMin() } to
 * {@link XYMultipleSeriesRenderer#getXAxisMax() } that can be achieved by zooming out.  {@literal 0} means no limit.
 * @param minRangeY The minimum distance from {@link XYMultipleSeriesRenderer#getYAxisMin() } to
 * {@link XYMultipleSeriesRenderer#getYAxisMax() } that can be achieved by zooming in. {@literal 0} means no limit.
 * @param maxRangeY The maximum distance from {@link XYMultipleSeriesRenderer#getYAxisMin() } to
 * {@link XYMultipleSeriesRenderer#getYAxisMax() } that can be achieved by zooming out. {@literal 0} means no limit.
 */
public void setZoomLimits(double minRangeX, double maxRangeX, double minRangeY, double maxRangeY) {
    if (chart instanceof XYChart) {
        XYChart xyChart = (XYChart) chart;
        xyChart.getRenderer().setZoomLimits(new double[] { minRangeX, maxRangeX, minRangeY, maxRangeY });
    } else {
        throw new RuntimeException("setZoomLimits() only supported for XY charts");
    }
}
Also used : XYChart(com.codename1.charts.views.XYChart)

Aggregations

XYChart (com.codename1.charts.views.XYChart)2 XYMultipleSeriesRenderer (com.codename1.charts.renderers.XYMultipleSeriesRenderer)1