Click here to Skip to main content
Click here to Skip to main content

High Speed, Feature Rich, and Easy-To-Use Graphs and Charts

By , 29 Nov 2006
 

Sample Image - GraphComponents.jpg

Introduction

This project was developed for the impatient developer (that's me sometimes, and probably you!) who's sitting late at night downloading charting libraries only to figure out that it's too complex to set up, isn't dynamic, and doesn't provide the necessary customizations.

Well, GraphComponents hopes to provide an answer to these common problems. In short, GraphComponents is a .NET user control that provides you the following features:

  • Easy to use in the Visual Studio designer IDE
  • Easy to configure during runtime
  • High speed updating
  • Rich features like custom color settings, custom background settings, smart numbering, reference values and lines, grids, transparent bars, etc.

GraphComponents currently supports Bar Graphs, Stacked Bar Graphs (Multi-bar Graphs), and a N-Channel Plotter Oscilloscope (Plotter CRO). Future versions should see other kinds of graphs too.

Usage

GraphComponents is accessible as a control from the control toolbox in Visual Studio .NET. To access GraphComponents, first launch Visual Studio .NET, and create a new Windows Application project. Open the Form Design so that it appears in the current window. View the toolbox using the View/Toolbox menu command. Right-click inside the "General" or "Components" sub-pane of the tool box, and select the "Add/Remove Items..." option. In the "Customize Toolbox" dialog that appears, select ".NET Framework Components". Click "Browse...", and navigate to the GraphComponents.dll file. Once this file is added, you should see a BarGraph, StackedBarGraph, and a Plotter option in the toolbox.

Using the Stacked Bar Graph

  • Create a new Windows Application project as described above.
  • Drag and drop the StackedBarGraph onto the form.
  • Drag and drop two Buttons (Button1 and Button2) onto the form.
  • Double click Button1. This will place a Button1_Click() function in your C# file.
  • Double click Button2. This will place a Button2_Click() function in your C# file.
  • Add the following code in the Button1_Click() function:
    // Increment the bar value by 10
    stackedBarGraph1.Bars[1].BarValue += 10;
    stackedBarGraph1.UpdateDisplay ();
    
  • Add the following code in the Button2_Click() function:
    // Decrement the bar value by 10
    stackedBarGraph1.Bars[1].BarValue -= 10;
    stackedBarGraph1.UpdateDisplay ();
    
  • Build and run the application. You have a very basic framework ready for using the StackedBarGraph. Examine the sources of the walkthrough projects for both the BarGraph and the StackedBarGraph.
  • Now, getting back to the Form Design view, adjust some of the properties of the graph in the Properties pane.
  • Set the BarOrientation property to Horizontal to get a horizontal bar graph. Notice that any change you make is instantly updated in the form's design view itself.
  • To perform high speed updating for measuring various things like pulse count, cylinder pressure of a 6 cylinder engine, music tones etc., you just have to set up a timer and update the bars accordingly. Examine the source of the GraphUsageDemo application for configuring high speed displays.

Using the Plotter Oscilloscope

The plotter oscilloscope is useful when you want to capture various input signals and observe them. The Performance tab of the Windows Task Manager has two simple plotters for monitoring CPU usage history and page file usage history. On Windows 2000 or XP, you can view the Windows Task Manager by pressing Ctrl + Shift and then pressing Esc.

Another thing about plotters and CROs in general is that they receive inputs through their 'channels'. If you observe the Plotter in the GraphUsageDemo application, you can see that the Advanced Body Measurement System measures four parameters (voltage, current, body pulses, and metabolism) through its four channels. While a simple low-end CRO has two channels, a hi-fi CRO (called as a spectrum analyser) can have many input channels. OK, enough with electronics theory! Let's get back to .NET.

  • To use a plotter, create a new Windows Application project as described above.
  • Drag and drop the Plotter onto the form.
  • In the form's constructor, add the following line after the InitializeComponent(); line:
    // Start the plotter
    plotter1.Start ();
    // Set the plot rate to 200 ms - which means that
    // the plotter's samples are spaced 200 milisecond apart
    plotter1.PlotRate = 200;
    
  • Go back to the Form Design view and drag and drop a Button (Button1) onto the form.
  • Double click Button1. This will place a Button1_Click() function in your C# file.
  • Add the following code in the Button1_Click() function:
    // Generate random values for plotting on the 1st and 2nd channel
    Random r = new Random ( (int) DateTime.Now.Ticks);
    plotter1.Channels[0].CurrentValue = r.Next (0, 100);
    plotter1.Channels[1].CurrentValue = r.Next (0, 5);
    
    plotter1.UpdateDisplay ();
    
  • Build and run the application. Keep clicking Button1, and the plotter starts plotting two separate lines for its two channels. You now have a very basic framework ready for using the Plotter. On the top left hand corner of the plotter, you can see the < and > icons. These are used for navigating to the next and previous channels. On surfing channels, the currently active channel appears brighter. The + and - icons below are used for offset adjustment. You can experiment by clicking these buttons and repeatedly clicking Button1.
  • By default, channels 1 and 2 are enabled, while channels 3 and 4 are disabled. The X axis time range is set to 9 seconds. Once the plotter has reached the right side, it automatically scrolls to the left. Also, by default, the upper and lower limits for channel 1 are set to 100 and 0. The upper and lower limits for channel 2 are set to 5 and 0.
  • Examine the sources of the PlotterWalkThrough project and the Plotter part of GraphUsageDemo.
  • Now, getting back to the Form Design view, adjust some of the properties of the plotter in the Properties pane. For example, adjust the PlotRate, GraphMarginLeft, and GraphMarginTop.
  • To perform high speed updating for measuring various things like voltages, currents, etc., you just have to set up a timer. Also note that the PlotRate must tally with the timer's Interval to get an accurate measurement. Examine the source of the GraphUsageDemo application for configuring high speed displays.

While using this in your code, it is useful to know the following things:

  • Start() starts the plotter.
  • Stop() stops the plotter. If the plotter has scrolled, then a scroll bar appears allowing you to see the earlier plots.
  • Start() and Stop() also act like Resume and Pause. So you can pause, examine the graphs, and resume by using the same two functions.
  • Reset() erases the plotter and makes it fresh for using again.
  • The CompressedMode property allows you to view the entire plot in the graph area without any scrolling.
  • NextChannel() and PreviousChannel() allow you to surf channels.
  • A channel can be enabled or disabled. You cannot see the output of a disabled channel.
  • If you are not satisfied with four channels, you can add more channels by easily changing the source code. The upper limit is based on how satisfied you are with the performance. So, you could possibly set up 8 channels and observe the data bus of an 8-bit microprocessor.

Acknowledgements

I would like to thank my wife Shubha, for providing me with some cool ideas with respect to usability, and for lots of other small things. Also, thanks to some of my friends in my current and previous companies, with whom I discuss a lot about software.

Conclusion

Hope you find this library useful and that you enjoy using it. Please send your criticisms, bugs, ideas for new features, and suggestions to anupshubha@yahoo.com. I would be especially happy with any ideas adhering to the "Keep It Simple" principle.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Anup. V
Software Developer (Senior)
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionThe compiled demo looks cool but unable to run the src in vs 2008memberMember 83787699 Sep '12 - 1:43 
If find this demo very nice but I am unable to run the src in VS 2008. The conversion passed successfully but unable to view the design form of all the demo parts.
 
I would appreciate you can help on how to use it on VS 2008. Thanks.
SuggestionPlotter librarymemberRaghu Devisetti26 Aug '12 - 2:50 
This topic is very much useful to me.
 
But I would like to know whether this library can be used to draw the ECG waveform in real-time? And also some more graphs along with that and display some fugures like heart beat rate etc. on the same screen.
 
Hoping to see the answer soon, as this is critical to my project.
 

I am doing one project, as part of this project PC receives 5 different signals on the RS-232 interface usinjg a proprietary protocol and the PC displays the data in the form of graphs on the screen in real-time.
 
I decided to use Visual C#.Net to do this project. Please let me know whether it is possible to do with the available libraries/classes in Visual C#.Net and is it easy to do this project.
 
Thanks & Regards,
Raghu D
QuestionGreat jobmemberSiva k Vengadesan26 Oct '11 - 7:12 
hi buddy,
you done a great job... I was excited with ur stuff.. awesome project which can able to understand in fewer minutes... keep going... Smile | :) Big Grin | :-D Thumbs Up | :thumbsup:
$!v@

Questionspeed questionmemberGabeA9 Aug '11 - 8:44 
This plotter works very well. I used the plotter to graph 750 two-digit random numbers as fast as possible, and it took about 7 seconds to do so. Is there anyway to speed up the plot rate so that the plotting frequency is around 1000 hz?
 
Thanks
GabeA
GabeA

Generalgreat plotter and a questionmemberMember 773407527 Mar '11 - 18:47 
hey first I would like to say thank you and well done for this project! i love what you did with the plotter, serves me very well! However, it seems that its not really complete as in the "SaveToFile" function. I'm wondering if have you updated it? If not, may I know how to save it and save it into which format? Thanks a lot!
Questionplotter axis linememberBillC732 Feb '11 - 17:48 
I'm new to Visual Studio (I installed VS2008) and C# but got plotter working pretty quickly.
 
This is a very nice Component.
 
How would I turn off or reposition the centered, horizontal, line on the plotter graph?
 
Is this possible?
 
Thanks, BillC73
GeneralLicensememberFandi Gunawan29 Oct '09 - 16:57 
What is the license of your DLL ?
 
I'm no one

QuestionIt freezes when i move my window ?memberLTIDK6 Sep '09 - 15:27 
using the plotter to plot values from a file. If i move the window during plotting, then the update of the plotarea & form halts ?
 
Also during plotting it seems that updating of other gui controls ex a listbox doesnt seem to work very well.
 
Any inputs ? thanks.
Questionvisual basic 2008 and exporting plotter datamemberArio Fitrianto24 Jun '09 - 23:39 
hi.
 
i'm about to use plotter component in my project which use vb 2008.
i tried to convert the source code provided in the demo (which is in C#) to vb.net but still not working. does anyone have converted the source code into vb??
 
and then, i would like to export/save the graph shown in plotter component into image format.
is it possible to to that??
 
thanks for answering...
 
Ario...
GeneralZoomingmembermazhengm227 Mar '09 - 6:27 
Maybe zooming should be enabled in the next version? Smile | :)
GeneralNice control but I'm seeing a display problem with the buttonsmembermschuckmann3 Feb '09 - 13:07 
First, nice control. Took me a bit to figure out exactly how your supposed to use it but once I got into the demo apps I figured it out.
 
I am having a problem with the next/previous channel buttons and the shift up/down buttons in the control.
In my application the lower half of the > < + - characters are cut off, it appears this way in both the designer
and when I run my application.
 
If I look at your demo application it appears the same way in the designer but when I run your demo app the buttons look correct.
 
For the life of me I can't figure out what's different. I'm thinking that must have something to do with screen resolution or scaling, any thoughts?
 
Thanks
Matt S
GeneralHi I want to add more channelsmemberhimanshu110122 Jan '09 - 22:49 
Thanks for such a good component but i can not add more than 4 channels.
Is there any way to do that then please let me know..
 
Regards
Himanshu
9968499516[India]
GeneralResizing problemmemberFouinard13 Oct '08 - 7:44 
When looking at your demo project, I noticed it goes into infinite loop when you set the height of the graph container to 0.
 
Regards
Rémi
QuestionSetting Plotter Y Range?memberMember 54067798 Aug '08 - 5:22 
I was just wondering if setting the maximum value on the Y axis for the plotter was possible. I am using it like a line graph. If there is an easier way please let me know Smile | :) .
 

Very Cool dll btw!
AnswerRe: Setting Plotter Y Range?memberLukgaucho7720 May '09 - 3:11 
try this:
below InitializeComponent() put this:
plotter1.Channels[0].MaximumValue=......;
plotter1.Channels[0].MinimumValue=......;
GeneralCursor values in stop modememberLOSMI30 Jan '08 - 7:58 
Hi,
First of all this library is great,one of the best i found on the internet.Can I access the points that cursor is showing in stop mode,by that I mean to get values that cursor shows on graph?
 
Best regards and keep up the good work......
GeneralPlotter data controlmemberjknickel6 Nov '07 - 3:19 
Hi
 
Thanks for lovely little graph library, it's exactly what I've been looking for. I am capturing data from a model aircraft in real-time, and display the data using my own graphic controls, and this plotter adds a nice way to display the history of the values. Although I do save the data to a file, but it's a pain to import it to Excel everytime.
 
I noticed that if I disable some of the channels, it still cycles through the channels using the arrow controls. I would like it to skip the disabled channels. It would also be nice to assign a certain number of channels to the plotter, that way if I only have two traces, then I don't need to disable the others.
 
Something else I would like, is to have a second scale on the right, if I display two different ranges of values at one time. It would also be nice to have some kind of legend, or label for each channel trace.
Questionhow to import data from excel to this graphs?membermmshah413 Oct '07 - 17:13 
I want to make my graphs excel compatible. I am making my excel sheets dynamic in nature and want to import values to my GUI application. Can someone guide me how can I do that using this graphs?
 
Mandip Shah
Mandip.shah@asu.edu
QuestionStand-alone real-time plotter?membergragus13 Sep '07 - 18:36 
This system looks really cool...
What I was actually looking for is some sort of FREE plotting-system that can be kicked off from my own program, but then runs stand alone. That is, I want to avoid building my own GUI in which I integrate the chart controls. Ideally, I would like to just click a button that calls some sort of PlotLib::OpenPlotWindow command and then simply feed the data to the window.
 
I found a suitable open-source real-time plotter like that for Java (LiveGraph: http://www.live-graph.org), but so far nothing for .NET.
 
Any ideas?
GeneralVariable plotrate problemmemberbombompb2 Aug '07 - 4:04 
The first thing I want to mention is that it is a very nice control!
 
I use your plotter control to monitor some variables of an embedded system. Due to the fact that Microsoft Windows is not a real-time O.S. and the communication bus between the Windows System and the embedded system is not deterministic, I calculate and update the plotrate every send-receive cycles. When I stop the plotter I noticed that the coordinates displayed when hovering over the graph are not calculated correctly. I checked your code and I think it has to do with the fact that your code (method: DrawXYText in Plotter.cs) assumes a fixed plotrate Smile | :)
 
The peace of code is a little bit hard to get. When I have more time I will try to fix it. Have you planned any updates?
 
Thanks!
GeneralRe: Variable plotrate problemmemberbombompb2 Aug '07 - 22:12 
Well I already found some time to take a look at the problem and I have a solution:
 
Update the following code in the function: DrawXYText
 

...........
...........

int modulo = actualX % plotRate;
actualX -= modulo;

int pointsOffset = actualX / plotRate;

float y = float.NaN;
string coordinate = "";

if (activeCh.Points.ContainsKey (pointsOffset))
{
PointF selectedPoint = (PointF) activeCh.Points[pointsOffset];
y = selectedPoint.Y;
}

 
int last_diff = -1;
int last_x = 0;
float last_y = 0;
int current_diff = 0;
// Find the closest match for the x value!
foreach (PointF value in activeCh.Points.Values)
{
current_diff = Math.Abs(actualX - (int)value.X);
if ((last_diff == -1) ||
(current_diff == Math.Min(current_diff, last_diff)))
{
last_diff = current_diff;
last_x = (int)value.X;
last_y = value.Y;
}
else
{
actualX = last_x;
y = last_y;
break;
}
}
...........
...........

 
Maybe it can be more efficient, but it works. The only little thing about this code is that if you point the cursor to a position outside the plotted range, it will show you the last point of the plotted range and not the y = '-' value.
QuestionStacked Bars?memberlessms20 Jul '07 - 6:04 
Thank you for such a nice control.
 
I have a question about the bar chart. Is it possible to have "stacked bars"? For this I mean a single bar (imagine a vertical bar) that has had different values appended to it, and perhaps each appended value shows as a different color.
 
I've see this called "stacked bars" on other graph components.
 
Thanks again.
 
Big Grin | :-D
GeneralA couple of fixesmemberMichael Moore21 Jun '07 - 14:35 
A very nice jobBig Grin | :-D .
 
I ran into a problem with the auto scrolling when plotting several simultaniously updatng Channels. - Channel[0] would plot to the right of the graph, triggering the autoScroll operation. The rest of the channels would plot one plotRate interval to the left.
 
I fixed this by replacing the comparison from the plotter's TotalElapsedTime to the Channel's TotalElapsedTime (inside the Plotter.Draw method)
that is:
if (! scrollAdjusted)
{
// if (TotalTimeElapsed > rightDisplayLimit)
if (channel.TotalTimeElapsed > rightDisplayLimit)
{
 
I must admit, I didn't follow the logic for changing plotRate's etc., so this might not be the correct fix for everyone.
 
The second problem is somewhat related to the first. You calculate the horizontal tick interval as an integer instead of a float, leading to an accumulating error in drawing the X axis grid lines. This also happens with the Y axis grid lines.
The fix is to change GraphDecorators\Gridline.cs as so:
 
if ((parentGraph.Gridlines & GridStyles.Horizontal) == GridStyles.Horizontal)
{ graphics.SetClip (parentGraph.GraphArea);
// int gridSize = parentGraph.GraphArea.Height / parentGraph.GraduationsY;
float gridSize = (float)parentGraph.GraphArea.Height / (float)parentGraph.GraduationsY;
// for (int i = 0; i < parentGraph.GraphArea.Height; i += gridSize)
for (float i = 0; i <= parentGraph.GraphArea.Height; i += gridSize)
{
graphics.DrawLine (graphAreaPen, parentGraph.GraphArea.Left, parentGraph.GraphArea.Top + i, parentGraph.GraphArea.Right, parentGraph.GraphArea.Top + i);
}
}
 
if ((parentGraph.Gridlines & GridStyles.Vertical) == GridStyles.Vertical)
{
// int gridSize = parentGraph.GraphArea.Width / parentGraph.GraduationsX;
float gridSize = (float)parentGraph.GraphArea.Width / (float)parentGraph.GraduationsX;

// for (int i = 0; i < parentGraph.GraphArea.Width; i += gridSize)
for (float i = 0; i <= parentGraph.GraphArea.Width; i += gridSize)
{
graphics.DrawLine (graphAreaPen, parentGraph.GraphArea.Left + i, parentGraph.GraphArea.Bottom, parentGraph.GraphArea.Left + i, parentGraph.GraphArea.Top);
}
}

The only downside I see is that the right hand edge grid line is now outside the clipping area, so it looks messy. To fix this, we need to do some more work...

 
I blame Bush...
QuestionUsing free?memberhansipet20 Jun '07 - 2:13 
Is this library for free use?
 
Best regards
Hansjörg
QuestionLogarithmicmemberXsiXmaX19 Feb '07 - 2:54 
Can i set a logarithmic base 10 scale?
 
Tanks
Generalautomatic scroll to the rightmemberhubert819 Feb '07 - 3:12 
hi anup
i´m using your plotter and it works really fine. but one question.
I am starting and stopping the plotter after every measurement that i do. how can i avoid the plotter to scroll to the left after evrey cycle? i want to see the last two measurement without scrolling manual.
 
thanks for your offerts
 
hubert81
Questiondisplaying serial port output using GraphComponentsmemberghostz1326 Jan '07 - 3:35 
Hi Anup,
 
I'm using your GraphComponents to plot the output from my micro-controller which outputs data in hex format.. using hyperterminal i get 0000 to 0fff as my output from the microcontroller.
 
I cast the output from the COM port as float and send it to the channel for display but it doesnt seem to work... I have implemented code to append output from the COM port to a logger.txt and it correctly shows its receiving output so i do not think the problem is with the serialport code.. can you pls enlighten me? thanks in advance.
 
gerardtay[at]yahoo[dot]com
 
My code is as of below:
 
private void plotterTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
byte[] buffer = null;
int offset = 0;
int count = 2;
//plotter1.Channels[0].CurrentValue = (float)(5 * r.NextDouble());
plotter1.Channels[0].CurrentValue = (float) (serialPort1.Read(buffer,offset,count));

if ( plotter1.Channels[0].Enabled)
{
plotter1.UpdateDisplay();
}
}
AnswerRe: displaying serial port output using GraphComponentsmemberLukgaucho7720 May '09 - 0:50 
Try To use this:
define a int update var;
use this for collect data:
private void SerialPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
//insert a code to assign Serialport.ReadByte() to a var
this.invoke(new EventHandler(DisplayText));
}
to show the data:
private void DisplayText(object sender,EventArgs e)
{
plotter1.Channels[0].CurrentValue=(float) (your result data);
update++;
if (update==1)
{
plotter1.UpdateDisplay();
update=0;
}
QuestionWhere's the dll?memberstjds1 Jan '07 - 10:04 
Confused | :confused: Couldn't find the GC dll that you mention to add components. It wasn't in the zip file.
 
stjds
AnswerRe: Where's the dll?memberAnup. V2 Jan '07 - 2:47 
hi,
the dll is called GraphComponents.dll. It is contained as a project (GraphComponents) in the solution GraphComponents.sln. The other projects in this solution are all applications.
 
Regards
Anup
GeneralRe: Where's the dll?memberghostz1322 Jan '07 - 3:55 
Hi, I'm using Visual Studio 2005 and i keep getting an error msg when i try to convert the solution.. any idea why? I wish to import tis library into a VB project.. is it possible?
 
Conversion Report - GraphComponents
Time of Conversion: Monday, January 22, 2007 22:53 PM
 

Solution: GraphComponents
Filename Status Errors Warnings
GraphComponents.sln Converted 0 0
Conversion Issues - GraphComponents.sln:
Solution converted successfully

1 file Converted: 1
Not converted 0 0 0
 
Project: BarGraphWalkThrough
Filename Status Errors Warnings
BarGraphWalkThrough\BarGraphWalkThrough.csproj Not Converted 2 0
Conversion Issues - BarGraphWalkThrough\BarGraphWalkThrough.csproj:
Project file is not writable: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\BarGraphWalkThrough\BarGraphWalkThrough.csproj
Unable to save converted project file.

1 file Converted: 0
Not converted 1 2 0
 
Project: GraphComponents
Filename Status Errors Warnings
GraphComponents.csproj Not Converted 2 0
Conversion Issues - GraphComponents.csproj:
Project file is not writable: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\GraphComponents.csproj
Unable to save converted project file.

1 file Converted: 0
Not converted 1 2 0
 
Project: GraphUsageDemo
Filename Status Errors Warnings
GraphUsageDemo\GraphUsageDemo.csproj Not Converted 2 0
Conversion Issues - GraphUsageDemo\GraphUsageDemo.csproj:
Project file is not writable: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\GraphUsageDemo\GraphUsageDemo.csproj
Unable to save converted project file.

1 file Converted: 0
Not converted 1 2 0
 
Project: PlotterWalkThrough
Filename Status Errors Warnings
PlotterWalkThrough\PlotterWalkThrough.csproj Not Converted 2 0
Conversion Issues - PlotterWalkThrough\PlotterWalkThrough.csproj:
Project file is not writable: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\PlotterWalkThrough\PlotterWalkThrough.csproj
Unable to save converted project file.

1 file Converted: 0
Not converted 1 2 0
 
Project: StackedBarGraphWalkThrough
Filename Status Errors Warnings
StackedBarGraphWalkThrough\StackedBarGraphWalkThrough.csproj Not Converted 2 0
Conversion Issues - StackedBarGraphWalkThrough\StackedBarGraphWalkThrough.csproj:
Project file is not writable: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\StackedBarGraphWalkThrough\StackedBarGraphWalkThrough.csproj
Unable to save converted project file.

1 file Converted: 0
Not converted 1 2 0
 

Conversion Settings
Solution File: C:\Documents and Settings\u0307692\Desktop\GraphComponents_src\GraphComponents_src\GraphComponents.sln
 

GeneralRe: Where's the dll?memberNAB3716 Feb '07 - 8:44 
I had the same issue. First, all the files were Read Only for some reason...so I fixed that and ran the conversion again. Things were better but I had many errors when I tried to compile.
 
As was stated before;
"You need to rebuild the whole project and remove the old reference and add the new rebuilt one from this directory "GraphComponents_src\GraphComponents_src\bin\Debug" "
 
After you perform the conversion, ignore any errors, look in the Solution Explorer at GraphUsageDemo and then at its References. The GraphComponents reference is broken. Remove that reference and replace it with a current reference to the dll in the bin\Debug folder.
 
Recompile....it's all good!
Questionis DLL code available?memberelwolv13 Dec '06 - 22:04 

is the code for the graphic components DLL in the demo folder is available?
 
I am interested in the real time ploter to apply to application.
 
I want to include the ploter and isert other symbols and format to the ploter.
 
the real time ability of this implementation is great in GDI+!!
 
Did you consider WPF/Vista graphics engine for a real time graphic components?
 
elwolv
 
elwolv

QuestionRefresh time less than 40 msmemberhellamasta11 Dec '06 - 3:49 
Hi!!! I found great your plotter control! I'm traying to use it to display a signal acquisition.
But if I have signals that changes in less than 40 ms, all application doesn't respond to inputs.
I use the plotter in a new thread and in this thread I use a timer to generate ticks.
 
Do you have any suggestion?
 
Thank you in advance and sorry for my bad english Smile | :)
 
Alessio
AnswerRe: Refresh time less than 40 msmemberAnup. V11 Dec '06 - 8:36 
Hi,
Thanks for the compliments Smile | :)
For the time being this could help (maybe)
What you can do to draw a line graph is for every timer elapsed, set the CurrentValue and not call the UpdateDisplay () function. After setting all the values, you can call update display once.
 
eg.
 
int update; // a member variable
private void plotterTimer_Elapsed (.......)
{
// keep assigning values each time the timer elapses
// The plotter stores all this internally
plotter.Channels[0].CurrentValue = x;
 
update ++;
 
// refresh the screen once every 50 times.
if (update == 50)
{
plotter.UpdateDisplay ();
update = 0;
}
}
 

With this you can get low times plotted (like 1 ms or less, but the actual refresh happens every 50 ms or so). This should be okay because if the control were to draw and scroll for every 1 ms, then we could not see anything but a blur on the screen.
 
Hope this helps you. If not, i am currently working on a fast oscilloscope. I will try to finish that once i get some free time.
 
Regards
Anup
GeneralRe: Refresh time less than 40 msmemberhellamasta11 Dec '06 - 11:31 
Thanks a lot for your help.
 
I was thinking about implementing the plotter using asynchronous threading pattern, for example with background process. By this way maybe it's possible to have faster refresh without blocking main application form.
 
What do you think about this?
 
Thank again!
 
Big Grin | :-D
 
Alessio
QuestionVery nice control! Is line graph possible?memberRaymond Verbruggen8 Dec '06 - 23:04 
Hi,
 
This is a very neat control! Thanks a lot.
 
One question, is it possible to create a line graph?
 
Kindest regards
Raymond Verbruggen
Netherlands
AnswerRe: Very nice control! Is line graph possible?memberAnup. V11 Dec '06 - 8:31 
Hi,
Thanks for the compliments Smile | :)
For the time being this could help (maybe)
What you can do to draw a line graph is for every timer elapsed, set the CurrentValue and not call the UpdateDisplay () function. After setting all the values, you can call update display once.
 
eg.
 
int update; // a member variable
private void plotterTimer_Elapsed (.......)
{
// keep assigning values each time the timer elapses
// The plotter stores all this internally
plotter.Channels[0].CurrentValue = x;
 
update ++;
 
// refresh the screen once every 50 times.
if (update == 50)
{
plotter.UpdateDisplay ();
update = 0;
}
}
 

Hope this helps you. If not, i am currently working on a fast oscilloscope. I will try to finish that once i get some free time.
 
Regards
Anup
GeneralConvert Project to Visual Studio 2005memberdavidhman4 Dec '06 - 5:04 
Has anybody converted this project to VS2005?
GeneralRe: Convert Project to Visual Studio 2005memberghostz1322 Jan '07 - 14:09 
keep having error msgs... but i'm trying to use the dll from the demo zip...
GeneralRe: Convert Project to Visual Studio 2005memberdavidhman23 Jan '07 - 3:53 
You need to rebuild the whole project and remove the old reference and add the new rebuilt one from this directory "GraphComponents_src\GraphComponents_src\bin\Debug"
GeneralRe: Convert Project to Visual Studio 2005memberghostz1326 Jan '07 - 3:26 
it works fine when i copy paste the dll frm the demo into the toolbar....
AnswerRe: Convert Project to Visual Studio 2005membervaltrig23 Feb '07 - 9:24 
I have converted everything for Visual Studio 2005. I've also corrected a bug regarding the timers that update the controls (more information below if anyone is interested).
 
The new zip can be found here http://rapidshare.com/files/17935692/GraphComponents_src.zip.html[^]
 
Anup: I have only made the modifications described below. Should you for any reason want me to remove the file from the above link, please reply to this message.
 
WARNING - WARNING - The following information is slightly technical (and potentially unimportant and boring to some people):
 
When I compiled and executed Anup's application in debug mode under VS2005, it immediately crashed on me giving me a warning that timer threads where trying to access the various GUI controls. The reason for this situation happening is because the System.Timers.Timer class uses a separate thread to operate and raise events. The problem is that whenever a Windows visual control is being manipulated by a thread other than the one that created it, can lead to unpredictable behaviour by the application that hosts that control.
 
In version 2 of the .NET Framework a new static property was added to the System.Windows.Forms.Control class, namely CheckForIllegalCrossThreadCalls. The default value of this property is true and whenever a control is accessed by a thread other than the one that created it (i.e. the application's GUI thread), an InvalidOperationException is thrown, allowing you to detect the problem and correct it.
 
Setting the afore mentioned property to false will prevent the exception from being thrown but the problem of unpredictable application behaviour is still there, (and according to Mr. Murphy, waiting to occur at the worst time possible Laugh | :laugh: ).
 
What I did as a quick fix was to replace all instances of System.Timers.Timer with System.Windows.Forms.Timer which is similar in functionality but operates using the GUI thread instead of a separate one. Another solution would be to keep the system timers and use the Control.Invoke() method for updating the controls, but it requires a bit more effort and I feel kind of Sleepy | :zzz: right now!
 

Generalwow!memberJohn Lindon29 Nov '06 - 7:05 
i'd seen this earlier when there was just the bars, but this plotter is something else!! fantastic. a 5er from me after seeing the plotter!
GeneralRe: wow!memberAnup. V11 Dec '06 - 8:40 
Hi,
Thank you very much! I get lots of josh (enthusiasm/begeisterung) seeing messages like this Smile | :)
 
Regards
Anup
Generalgood jobmemberAlmustafa18 Nov '06 - 17:40 
GDI+ it is very powerful when it is known to use
 

GeneralRe: good jobmemberAnup. V27 Nov '06 - 12:26 
Thank you. Yes it's very powerful indeed!
QuestionASP.NetmemberJohn Rummell15 Nov '06 - 8:27 
Can I use this in a web form?
 
Thanks,
John
AnswerRe: ASP.NetmemberAnup. V27 Nov '06 - 12:30 
Hi,
The idea behind this is that you get very fast updates (in miliseconds). So, it is meant to be used on a Windows forms application. But, if you want static images to be displayed, then with a little tweaking, it should be possible in a web form too.
 
Maybe in the future, with Atlas - Ajax and stuff, i will incorporate fast refreshing on a webform too!!

GeneralRe: ASP.Netmembersides_dale7 Dec '06 - 16:19 
There is a nice free charting control available for asp.net called webchart available at http://www.carlosag.net/Tools/WebChart/Default.aspx; have you looked at this control? and how does it compare in functionality and ease of runtime to the one you have? If yours is actually easier to configure that this one, I would be interested in assisting you in porting this to the asp.net enviornment, might give me an excuse to actually learn ajax.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 29 Nov 2006
Article Copyright 2006 by Anup. V
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid