Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Rogue lines appear on the 2D charting control

I am using a the 2D charting control in a VS 6 project for plotting a barchart/histogram for a dataset. I have been developing the application without problems until I moved to a new computer. On this new development computer I get these rogue lines appearing as you can see in the attached screen capture. These lines attach the upper point of a sample back to zero as you can see in the graphic. I have never witnessed this before on the other system. Both systems are running WIndows XP Pro (SP2). Upon further investigation I have found that this problem does appear on some computers and not others which are running the same OS and configured very similarly.

My first reaction was that this was caused by a datase
t issue. However, running the same dataset on other computers with the same exact application does not produce this error. As well, running ANY dataset on this computer does produce the issue but not on others.

Are there any known issues regarding this issue and certain video cards, configurations, etc.
0 Kudos
Message 1 of 12
(4,840 Views)
What version of Measurement Studio are you using? Can you post a project that demonstrates this? I'll try to reproduce it on a few machines here.
0 Kudos
Message 2 of 12
(4,840 Views)
I am using Measurement Studio 6.0.

Unfortunately I cannot post a project because this module is one part of a much larger application and I would never get permission to release the entire application.

Best I can do is give you the code snippet that is doing the actually plotting:
---------------------------------------------
CNiReal64Vector plotData(128);
ZeroMemory(plotData, sizeof(plotData));
pDoc->m_csVecL14.Lock();
// fill CNiVector
for(int i=0; i<128;i++){
plotData[i] = pDoc->vecL14[i];
}
m_graph.GetPlots().Item("PLOT1").PlotY(plotData, 0, 1);
------------------------------------------------------
0 Kudos
Message 3 of 12
(4,840 Views)
In addition to what I posted above I have another chunk of code below which I use to customize the appearance of the chart control. I managed to narrow the issue down to the 'FillToBase' feature. If I comment out this line (or set it to false), the issue disappears - but so does the functional appearance of the plot.

---------------------------------
//--- Plot Style ---//
m_graph.Plots.Item("PLOT1").LineColor = RGB(192,192,192);
m_graph.Plots.Item("BinCountHistogram").LineWidth = 1;
m_graph.Plots.Item("BinCountHistogram").LineStyle = CNiPlot::LineStyles(3); // YX Step
m_graph.Plots.Item("BinCountHistogram").FillToBase = true;
m_graph.Plots.Item("BinCountHistogram").FillColor = RGB(0, 0, 128);
m_graph.Plots.Item("BinCountHistogram
").LineToBase = true;
m_graph.Plots.Item("BinCountHistogram").LineToBaseColor = RGB(192,192,192);
m_graph.Plots.Item("BinCountHistogram").BaseValue = 0;
m_graph.Plots.Item("BinCountHistogram").Visible = true;
-------------------------------------------------
0 Kudos
Message 4 of 12
(4,840 Views)
There were two fixes made to cwui.ocx in Measurement Studio 7.0 that address issues with FillToBase that could possibly cause this behavior. I suggest that you update to the latest version of cwui.ocx and see if the issue still occurs. You can download the installer here. Please give this a try and let me know if it resolves the issue.

I doubt that this is related to the issue at all, but I suspect that your call to ZeroMemory is not doing what you intend it to do. When you pass plotData to ZeroMemory, your are invoking the cast operator, which is going to give you a pointer to the underlying data array, which is managed by
CNiScalarVector. The call to sizeof(plotData) is going to return the size of the CNiReal64Vector instance, not the length of the underlying data array. Incidentally, the size of the CNiReal64Vector instance is 20 bytes, while the length of the underlying data array is 1024 bytes. The default behavior of the vector, when initialized to a non-zero size, is to set all values to 0, so you do not need to do this explicitly anyway.
0 Kudos
Message 5 of 12
(4,840 Views)
I installed the update as you suggested - thanks for that.

Unfortunately, it hasn't solved the problem, but it has improved the issue somewhat. If you compare the attached screen capture with the original screen capture I posted you will notice that the lines have disappeared on the right peak. The downside is they are still there on the left peak so the problem still exists.

I also noticed that if I disable autoscaling and let the plot grow (vertically) so that the tops of the bars go off the top edge of the chart area, the rogue lines go away. As soon as I re-enable autoscaling to bring the plot back inside the chart area the rogue lines reappear. Thus, it may be a combined issue/conflict with using the 'FillToBas
e' and 'Autoscaling' simultaneously.

Thanks.
0 Kudos
Message 6 of 12
(4,840 Views)
I haven't been able to reproduce the problem. I suspect that my program is not similar enough to yours.

I don't understand what you are doing with the two different plots in your example code. What is the difference between "PLOT1" and "BinCountHistogram"? Are you plotting both of these on the same graph? If so, how is "PLOT1" configured? Is it possible that the unwanted lines you are seeing are a result of plotting "PLOT1"?

Something else you might try is using PlotXvsY for your histogram data instead of PlotY. Create an X vector of bins. Measurement Studio includes an example program that demonstrates this technique. It should be installed to MeasurementStudio\VC\Examples\Analysis\Histogram.

If these ideas d
on't lead us anywhere, I have attached the simple project that I was using to try to reproduce the problem. One option would be for you to modify the attached program to make it cause the problem and post the project back.

Based on the intermittent nature of the behavior you are seeing, this does seem like a bug, so I am very interested in tracking it down.
0 Kudos
Message 7 of 12
(4,840 Views)
The 'PLOT1' and 'BinCountHistogram' are the same plot. I started to rename the plot item to "PLOT1" to make it a little more generic and readable - obviously I didn't finish what I started - sorry for the confusion.

I will modify your attached project and try to reproduce the problem ...
0 Kudos
Message 8 of 12
(4,840 Views)
I recompiled and ran your project on my computer here and sure enough ... the lines are there!!

I added only one line to change the PlotAreaColor to something lighter to make the lines more visible - other than that your project is unchanged. There is a screen capture attached. It is interesting that the lines are projected back to zero on the x-axis in both cases - even when you have data being plotted at zero as in your example.

This project is experiencing the same situation as with my application; some computers do not have a problem, but some do. Very frustrating.

I will try your suggestion on changing my plotting method and see if that does anything.

Thanks.
0 Kudos
Message 9 of 12
(4,840 Views)
I modified my application to use the PlotXvsY technique but it made no difference unfortunately.
0 Kudos
Message 10 of 12
(4,840 Views)