Function:
- Drag a rectangle on the Chart to scale one or more data series;
- Double-click on the Chart to restore the status before scaling.
Click hereView the effect of this instance,Click hereDownload the source code of this instance.
In essence, we only obtain a new dataProvider through region selection, and then provide the Chart to simulate Chart scaling. Two tips are worth mentioning:
- Use the ChartItemEvent Change event instead of the itemMouseUp event to avoid scaling the Chart when dragging and selecting the blank space.
- Use findDataPoints to find out the number of HitData items selected. If the number is 0, the area is selected by dragging. If the number is 1, the area is selected by clicking the mouse, this avoids scaling Chart by clicking and selecting a single HitData.
- To ensure the practicability of selecting a single HitData generation curve for the region, the generated curve also includes two HitData near the HitData.