• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1130
  • Last Modified:

Create charts from SQL data in a web page

I have to create a website that displays SQL Server data in chart form.  Bar charts, line charts and some pie charts may be required.
The data is just tables of numbers like the winning lottery numbers by date.  
SQL queries will be doing sums, averages and such on the numbers to produce the data for the charts.
The Website is hosted on a "1and1" shared host with Microsoft SQL Server 2005 and ASP.Net 2.0 support.
Considering my experience level is "Beginner" in ASP.Net, VB, JavaScript, XML and SQL, how should I best approach this task?

I'm looking for the easiest way to get the data from the database into charts.

What chart technology would work best for this scenerio?

I've looked at amCharts, FusionCharts 2.0 (because it's free) and the Google Chart API.  I need someting easy to go from Query to chart.  Seems like XML is the way to go if the charts can read an XML file and I can get the queries to output to XML.

Thanks for suggestions, examples, experiences and code samples (especially SQL to XML examples)
  • 3
  • 2
1 Solution
You should definitely go for ZedGraph library.
Its a single dll you have to include in your project and can generate great looking
graphs with little or no time.
By little I mean is, using few lines of code, just passing your numbers in a array,
and it will create graph for you.
The best is that it has defaults for all kind of things, like for example, if you
forget to give bar width, no worries, because a default is there which will take
care for you.
If I read it properly, its under LGPL license

Here's the main page:

Here's its code project article which explains it nicely with lots of ready source code
available for download.


Moreover, It works with windows forms as well as web forms (two different dlls I guess)
You have to use the 'web forms' one.
Also, it can create images of charts and cache them  or it can directly render to image tags as required.
megninAuthor Commented:
I just started looking at ZedGraph and was wondering if it might work.  Thank you for recommending it.  It looks very nice.  
I think my next hurdle will be queries to get the calculations into those arrays.
megninAuthor Commented:
Thank you for the suggestion.  If you have experience with ZedGraph I would really appreciate any code or query examples you could share.  I'm not very experienced and examples sure are helpful.
Thank you again for recommending ZedGraph!
bind a DataTable to ZedGraphWeb to have it plot the datapoints


a full example on zedgraph wiki


(it uses rendermode :
Imagetag which means an IMG tag is generated in place and image is generated and saved in specified folder)

Hope it helped.
megninAuthor Commented:
Terrific!  Thank you.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now