Oldie But Goodie : Open Flash Chart – Fixing Open Source
This is from my old blog “Monster’s Got My .Net.” I didn’t realize that there was link to this on the OpenFlashChart site, so I am reposting it here for anyone that would like to use the code. Hope I didn’t inconvenience anyone.
So if you have ever had to write a report of any kind, you know how much your clients are itching to have some kind of chart on the page, and something with a lot of pizzazz. Well the problem is that those charts usually can cost you a pretty penny. Companies like Telerik and Infragistics offer great products, but for those with a budget (you cheap bast’d) there are great open source alternatives. The problem with open source sometimes is that it usually written to support multiple web technologies and not just ASP.NET. Everybody knows ASP.NET is the best and obviously these open source projects are written with a lapse in judgement, but forgiveness is the best policy because these projects can be awesome (just kidding about the lapse in judgement).
OpenFlashChart.zip (694.51 kb (Visual Studio 2008)
What I found in my search was Open Flash Chart,which is amazing. So I downloaded the project and installed it, and it had a .NET example in there (in chinese) and it worked but I didn’t like how it worked. I then looked on CodePlex and found someone who implemented a cool version of Open Flash Chart, but it didn’t work with the newer Open Flash Chart build. The newer version uses JSON. I decided to take both projects and merge them together to make a better mouse trap.This project was written using some of the new features of C# 3.0, so if you need to run it in 2005 then you might need to modify some of the code.
There are three aspects to this project: the ASP.NET Control, the Charts, and an HttpHandler. If you want to see the details of the infrastructure I suggest you look at the original author’s post, I only take credit for fixing it, but he wrote the ASP.NET infrastructure originally.
If you are intereseted in an Open Flash Chart control you can download the assembly here. I will also try to contact the original author and get the latest version on codeplex.
OpenFlashChart.zip (694.51 kb) Visual Studio 2008
Note: The HttpHandler solution utilizes cache, which works until you try to use it on load balanced machines without distributed cache. You can point the control to data pages as a work around. Play around and see what’s in the code. All credit goes to the original authors, I greatly respect their work and have included credit in the example project.
Update : How Ironic, the download to the fix didn’t work. I think it works now so you can download it.

July 21, 2010 - 4:39 am
Hi dude,
you’re a god like. I just finish to test your source code… WOW !!!
Why don’t you post this one on the openflashchart ??
Yeurl
July 21, 2010 - 6:48 am
here the same source code for vb.net 2008
Imports System
Imports System.Collections.Generic
Imports OpenFlash
Imports OpenFlash.Charts
Imports OpenFlash.Controls
Imports Bar = OpenFlash.Charts.Bar
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ofcTest.BuildChart()
End Sub
Protected Sub DrawChart(ByVal sender As Object, ByVal e As DrawChartEventArgs)
Dim chart As New OpenFlashChart()
chart.Title = New Title(“Test”)
Dim bar As New Bar()
Dim random As New Random()
bar.Colour = “#343″
bar.Fillalpha = 0.4
bar.Text = “Seb”
bar.Fontsize = 10
Dim values As New List(Of Double)()
For i As Integer = 0 To 12
values.Add(random.Next(i, i * 2))
Next
bar.Values = values
chart.AddElement(bar)
e.Graph = chart
End Sub
End Class
July 22, 2010 - 8:14 am
Thanks, but I just modified an existing library. I shouldn’t take all the credit.
July 22, 2010 - 12:10 pm
that’s the only who working under .net 2k8 … so at my view you need to take greets
July 23, 2010 - 9:32 am
i having a problem on the x and y axis legend… as you should remember, in the official openchart you can modify the x and y legend
source: http://teethgrinder.co.uk/open-flash-chart-2/x-legend.php
so, in our case i seek for the “x_legend”, but nothing… ok ok
so i take this way (in vb.net)…
g.X_Legend = New Legend(“Hour”)
no error compil, no warning… and so when it come on screen … it s blanck … i coment this line and i can see my correct result (but without my axis legend :s )
What’s wrong ? it’s coming from the source ?
regards