When trying to change data series: XAxis not defined.
This discussion was imported from CodePlex
Qwertie wrote at 2014-08-09 04:01:
I made a Windows Form for "streaming" data asynchronously from a set of running benchmarks. I create the
The first time the data is displayed, everything works fine. But after clearing and re-adding the series (without changing the
Am I doing something wrong? How to fix?
P.S. how do you designate an axis as an X or Y axis? For example when I add a
PlotModel
s in advance, and whenever new data arrives, I call model.Series.Clear()
and then re-add the Series again to show the new data.The first time the data is displayed, everything works fine. But after clearing and re-adding the series (without changing the
Axes
or anything else), the following red error message appears (even if the new data series is identical to the old data series):OxyPlot paint exception: XAxis not defined.
This happens whether the X Axis was auto-generated or added manually.Am I doing something wrong? How to fix?
P.S. how do you designate an axis as an X or Y axis? For example when I add a
CategoryAxis
it becomes the X axis by default, but how could I make a
CategoryAxis
that is a Y axis, or swap the X and Y axis?Qwertie wrote at 2014-08-09 19:13:
(I see, it's the
I notice that this is specifically a painting problem; if the graph is never painted on the screen (e.g. because it exists off-screen in a tab control) then I can clear the data series and repopulate it any number of times. The exception only occurs if the control is painted and then the data series are repopulated.
Edit: this is interesting, if I call
P.S. Other than this problem, this library is fantastic! I love the various automatic features like fact that the graph automatically figures out the extents of the graph and that the data series automatically conforms to whatever Axis I add.
Position
property e.g. Position = AxisPosition.Bottom
)I notice that this is specifically a painting problem; if the graph is never painted on the screen (e.g. because it exists off-screen in a tab control) then I can clear the data series and repopulate it any number of times. The exception only occurs if the control is painted and then the data series are repopulated.
Edit: this is interesting, if I call
PngExporter.Export(...)
then the png renders correctly. Not only that, but if I repaint the
OxyPlot.WindowsForms.PlotView
after exporting, it draws properly again.P.S. Other than this problem, this library is fantastic! I love the various automatic features like fact that the graph automatically figures out the extents of the graph and that the data series automatically conforms to whatever Axis I add.
Customer support service by UserEcho