Recommendations on plotting a graph - c#

I need to draw a graph like the one shown above in my application. The values for Y axis is updated periodically which is obtained from an electronic device and X axis refers to time elapsed . By default, the viewing range of X axis is automatically updated (extends horizontally) as seconds elapse.
One thing I find pretty challenging right off the bat is, users can also manually set the range of X and Y axis, so I need to come up with a flexible way to handle that part.
Can I get some recommendations on handling the above requirements? I prefer WPF but Winforms is fine too. Are there any example projects which solves a problem similar to above?
Or any third-party dlls I can use (for commercial purposes)?

One way I'm considering switching to right now is simply embedding a web control in whatever type of application (winforms, wpf) and then using html/javascript to draw the graph using an opensource library such as : flotr2, Style Chart, jqPlot, Protovis and D3. The benefit of doing it this way is that if you decide to change platforms your graphing doesn't need to change.
Right now I'm using Dynamic Data Display, which is a WPF graphing library.

winforms:
.NET3.5 onwards has chart controls built in (I think)
Im new to this too but you have to create the chart control and then create a series object with the data. Then the update the chart control with the series that contains your data.
There is a sample project here:
http://archive.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418

Related

Vertically Stacked Y-Axis Step Line in Live Charts WPF

I've been using Winforms and the built in Charting library to accomplish this task in a hacky sort of way, but the team I'm developing for wants a more interactive solution. I wish I was able to just stack several charts, but as the graph is representative of a digital timing diagram, they need to share the same x-axis. I'm looking at LiveCharts as a solution, but I can't figure out if it's possible to vertically stack the multiple y-axis items to achieve my end goal. Ideally, it would look like this:
It's very important that I maintain them as one chart so that they share the x-axis, and comparisons can be made within the same chart timing wise.
The data getting used is from a generated log file, and is not collected in real time. I would manually offset the data, but the user can choose the order in which the graphed lines are displayed, so I would have to go through the entire series and offset it each time the user moved it.
Perhaps livecharts is not the way to go here? It needs to be a free implementation of something, or SciCharts v2.2 (but I can't find archived documentation) as those are the only resources I currently have access to.
While your question doesn't specifically relate to SciChart, you have tagged it, so I have a suggestion for you.
There is a vertically stacked axis feature in SciChart WPF. This allows you to substitute the YAxis Container template for anything you want. In this example we use a UniformGrid. The result is as follows:
Several traces are on the same plot, but at different vertical positions. Each axis is stacked one over each other. They share the same XAxis and hence response to zooming, panning, tooltips as if they were one chart.
The source code to the above is on the Example Webpage. All the scichart WPF Examples source code is hosted on GitHub so if you click through to the above then scroll down to source and click 'View on Github' you can see how we have achieved this type of chart.
Disclosure to community: Im the tech lead on the SciChart project

Surface offline maps

I'm developing Surface application, but I came across a problem. I need to develop a control with next abilities:
World map on background (should display only continents).
I need a way to find out on which continent user touched(interactive background map).
Any controls can be added on the top of the map control (for an example video-player control for different regions of the map).
Map control should works in offline mode only (without any
connection to internet).
I can't find any frameworks that would meet my goals.
So, anyone know something projects/code samples that can help me to achieve my goals
Offline mapping could be done in many ways, one of them would be download / get shapefile for continents. (You can search for that). Later you can use SharpMap to display that shapefile in WPF application. SharpMap is a .Net framework based open source application which enables reading multiple geospatial formats.
Another option to read geo-spatial data is DotSpatial.

How to plot XY graph in C#?

I am developing an application in C# which deals with specific genetic algorithm problem. The execution of the algorithm provides output parameters that are required to draw a chart.The graphic chart consists of 2 independent axis, lets say X is number of generation and Y represents corresponding maximum value of fitness function. To be more specific, I've uploaded picture from Excel so here it is :
http://img97.imageshack.us/img97/2046/graphnb.png
My priority is to make this application fully-functional by allowing user (who sets random execution factors such as mutation percentage, population and generation number, number of elite individuals, etc.) to see generated X-Y graph inside the generated "Form" in C#. I've found site that partially solves my problem, but that's not the whole point (http://csharp.net-informations.com/excel/csharp-excel-chart-picturebox.htm). So I'm asking if there is a way to implement mentioned graph by not using any other applications, but maybe only C# libraries and functions for plotting or something like that? Hope I made myself clear. Best regards.
Free and native answer is http://zedgraph.org/wiki/index.php?title=Main_Page
Does not involve WPF
Does not cost
Only C# libraries
Works inside a .NET WinForm
personally I like XtraChart of DeveloperExpress, but there are also many many other cheaper or more expensive alternatives, also other questions similar to yours here in SO: WPF chart controls
I like to use libraries whenever I can so I can focus on my real business case instead of trying to re-invent the wheel everytime, also because usually it's not trivial to reach the same level of results of people working hard to deliver specific components.
As all have said you have to work on WPF (different platform then WinForms) with 3rd party charting library that are much easier to integrate with your application.
If you want to know further about charting library then you should see this page
Click here
If you can use it, try WPF. It's much better for developing graphically rich user interfaces than standard Windows Forms -- especially if you don't want to use third-party libraries.

Charting Components

im looking for a charting class library like Nevron or DevExpress that can handle with very big datasets (2 Millions points per second for example) are there better or more powerful Components? I need a few components to compare it among each other.
thanks
Did you checked the MS build in Charting Solution?
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
It is for Winforms and ASP.net and as far as I remember there are plans to implement WPF support (<- but not sure)...
Download here: http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&DisplayLang=en
Documentation here: http://www.microsoft.com/downloads/details.aspx?FamilyId=EE8F6F35-B087-4324-9DBA-6DD5E844FD9F
You cannot physically show more than 300-1200 pixels/inch on a printer and a lot less on a display.
Take those 2 million points and summarise every group of 1000-odd points (via mean, median, mode, maximum or minimum...), so that you end up with 2000 'summarised' points (this would be quick and easy to code). Charting 2000 summarised points makes much more sense for on-screen charting. Use a summary range of 100-500 points, if it will be printed (depending on printer DPI capability and chart size).
Internally, this is what most charting components will have to do, in any case.
Unfortunately it is not that simple - when you "summarize" the points using average for example you'll loose spikes in the data. It also depends on the series being plotted - it is one thing to summarize in a line chart with ascending x values and completely different thing when you summarize a xy scatter point chart. It also depends whether the user has zoomed the chart etc. so a professional charting library will have to take the level of detail (zoom factor), data spikes and series type into account.
In addition some charting libraries will use a direct interface to the video board (like OpenGL or DirectX) which is must faster than when you draw using GDI+ for example. I think you 're going in the right direction as the above two libraries are some of the best out there.

C# - Winforms - Animated Slideshow

Well i am developing an application whose interface requires an animated slide show
and by animated slide show i means UI components placed together change their positions after regular intervals in a sliding (animated) fashion. Let me illustrate my idea with the following image,
(source: deviantart.com)
in the image above there are three columns of UI components that i want to slide, what i could do is simply write a module to change x,y coordinates of the components that would give the animated slide effect but that does not work fine, because it is heave takes time in processing and all plus the coding will be complex and layer adjustment and all.
is there any slide show component on which instead of image i can place UI components
What are the other options i have or what is the right way to do it. Please need help.
Sounds like are looking for a carousel feature for you component. Winforms were not intended to be animated. Fortunately some companies have worked on products that support animaiton in this area but most are moving to the Silverlight and WPF platforms for those updated features. As a reader of MSDN Magazine I often come accross some interesting advertisements of Winform components that are quite interesting. Please take a look at this link. The cost of the product is quite high.
Telerik Sample Applications using Carousel feature in Win Forms
Also check out the following link to MSDN. It explains how you can reference the silverlight component as a COM object.
Using Silverlight in a Windows based application using COM
In this scenerio it could also be possible to embed a flash player with a flash animation, using one of the many (commercial and free) xml-based slideshows avaible for flash. This one for example http://www.flshow.net/.

Categories