Does anyone know a good method of generating bar/pie/line graphs in ASP ? I cannot use any commercial third party tool. Also I can't use any OCX or flash components.

My data is in Oracle which I am connecting using ADO. The graphs have to be generated dynamically from the database.


Recommended Answers

All 6 Replies

just a thought to consider, what about a javascript graph control, you could feed it a correctly formatted array to display the graph by using <% =ASPArray %>. There are a few out there that work pretty good.


I once did a fairly good bar chart using html tables and coloured table cells.
I made a borderless table containing rows of twenty cells (each cell = 5%) (I didn't have to be too accurate)
Then for each thing I was displaying I calculated the percentage of the total, picked a colour and set the background colour of the appropriate number of cells to the colour. i.e. suppose item one had a value of 50% I picked a colour (I think I used an array of colours and went through the array assigning them) then for the row I was generating for that item I calculated how many cells to colour 50/5 = 10 the HTML I generated for the row was something like this:

    <td colspan="10" style="background-color:red;">&nbsp;</td>
    <td colspan="10" style="background-color:white;">Myitem(50%)</td>

Then I put an extra row in as a key with a top and right border and right aligned text so you had 5%, 10%, 15% etc

That's an interesting approach G Waddell, but unfortunately it won't work in my case. I also need to generate line charts and pie charts and stacked bars etc. Doing them by HTML/CSS etc would probably be possible, but it would be quite cumbersome. hometownnerd's idea of using javascript led me to do some googling, and I think that would be a better approach, especially as I might need to port the site to PHP in near future. I am now planning to use Highcharts or Raphael, which looks like a good solution.

Thanks for your suggestion. Its always nice to see how different people approach the same problem in different ways ... and come up with interesting solutions.

I have used highcharts myself and really like it, especially the fact that you can use it for free, and they are always updating it as well.

I have also used highcharts as well. I would suggest that you take a look. Its very easy to deploy with static data, but can also be implemented in a manner that takes dynamic data when combined with server side scripting as you mentioned PHP. I've dabbled with it using ASP.NET.

I've used HightCharts with .NET with great success and I recommend it.

To obtain sofisticated user experience I suggest requesting data with AJAX in JSON format. The JS parser will be easy and fast. This way it's possible to achieve drill down funcionality that is really something else =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.