Can I add new axes, text objects, plot objects, and images to a chart after it is already displayed; or must I create a new chart from scratch taking into account the additional objects?
There are two ways to add new objects to a chart. The first way is to create all objects when the chart is initially created, but disable the ones that you do not want to show up when the chart is initially rendered. Enable the objects when you want them to show up. Use the chart objects setChartObjEnable method to enable/disable the object. This is useful if you are creating an animated chart where you want the chart to sequence through a predefined series of steps. The second way you add new chart objects to the ChartView using the ChartView.addChartObject method. In both cases you need to call the ChartView.updateDraw() method after any changes are made. The example below, extracted from the datacursorsandmarkers.DataCursorChart2.CustomChartDataCursor class, creates a new Marker object and NumericLabel object each time a mouse button clicked. // create marker object at place it at the nearest point Marker amarker = new Marker(getChartObjScale(), MARKER_BOX, nearestPoint.getX(), near
There are two ways to add new objects to a chart. The first way is to create all objects when the chart is initially created, but disable the ones that you do not want to show up when the chart is initially rendered. Enable the objects when you want them to show up. Use the chart objects SetChartObjEnable method to enable/disable the object. This is useful if you are creating an animated chart where you want the chart to sequence through a predefined series of steps. The second way you add new chart objects to the ChartView using the ChartView.AddChartObject method. In both cases you need to call the ChartView.UpdateDraw() method after any changes are made. The example below, extracted from the the CustomChartDataCursor class, creates a new Marker object and NumericLabel object each time a mouse button clicked.
Related Questions
- Can I add new axes, text objects, plot objects, and images to a chart after it is already displayed; or must I create a new chart from scratch taking into account the additional objects?
- I would like date labels on one of my axes. Can Grapher create a plot from a a worksheet column that contains my dates?
- How do you select a chart object and create a dialog panel that permits editing of that objects properties?