"Mark Greenman" wrote in message
news:39b7fc22@newsgroups.ni.com...
>
> I am attempting to use a CNiGraph control from CW++ in several dialogs in
> a strip chart mode. I want to be able to label the X-axis with time as
real-time
> data is collected.
If you are collecting data at regular intervals, you can configure the graph
to label the X-axis with the time values of your data points. You can
perform this configuration either maually or programatically. The following
code configures the graph to diplay data that is collected at 0.3 second
intervals. Once 10 points are displayed, it scrolls, hiding the old data
point and displaying new data points. For a dialog based application, you
can put this code in OnInitDialog. You call CNiGraph::ChartY(double y) to
add a point to the graph.
m_graph.ChartStyle = CNiGraph::ChartStrip;
CNiAxis xAxis = m_graph.Axes.Item("XAxis");
xAxis.AutoScale = false;
xAxis.Minimum = 0;
xAxis.Maximum = 3;
CNiTicks ticks = xAxis.Ticks;
ticks.MajorDivisions = 0;
ticks.MajorUnitsInterval = 0.3;
> I have set both axes to autoscale. Things work great until I try to
programatically
> adjust the X-axis start-point or duration. If I try to adjust the duration
> being plotted to a longer time period, the plot(s) become just small
segments
> of the new X-range. As points are added with the ChartY method, the plot
> traces do not grow in length to fill the new x-range.
I don't think you want XAxis autoscaling.
> What is the proper way to set/adjust the properties of the CNiGraph object
> to grow/shrink the X-axis range and have the plot traces fill the entire
> range?
You need to set CNiAxis::Minimum and CNiAxis::Maximum values. In chart
mode, these represent the initial range that the chart displays. When the
data you are reaching hits the maximum value the chart begins scrolling. The
CNiAxis::Minimum and CNiAxis::Maximum properties are the used to determine
the size of the widow of data that the chart shows.
> If I want to be adjusting the X-range, is it better to use the PlotXvsY()
> method instead of trying to treat as a strip chart? I believe this would
> require developing my own ring buffer, and I'm not sure how efficient the
> conversion from the ring buffer to the required CNiVector<> can/would be
> accomplished?
I think you can accomplish what you want with the strip chart.
> TIA,
>
> Mark Greenman
> Space Dynamics Laboratory
Let me know if this does not fit your requirements.
David Rohacek
National Instruments