I've already written about the Open Flash Chart and ASP.NET library to work with it. Since that time the version 2 of the flash component has been released. The flash component now uses JSON format of data, some new types of charts has been added such as horizontal bar chart and there are other “cool new features”.

The great work was done this post. The author adapted the library to use JSON format also added support of some new chart types as well as new properties. All I've done after it it just some refactoring testing, and bugfixing the library to support all the chart types.

I added two examples of lib usage in the project: the static 2 charts on page and the page with a chart inside UpdatePanel control to show how to properly embed in that case. The demo pages are here.  The source can be downloaded from codplex (VS2008 solution).

The second chart on the default.aspx page uses a custom data page and does not use ASP.NET cache. The control property SpecificDataHandler is designed to set the custom data page

<OpenFlash:OpenFlashChartControl runat="server" ID="ofcTest2" Height="350" Width="500" OnDrawChart="DrawChart" SpecificDataHandler="FlashData.aspx"/>

The FlashData.aspx is an ordinal ASP.NET page with nothing in aspx file and a code which simply builds and flushes an Graph object in the codebehind.

public partial class FlashData : System.Web.UI.Page
{
    protected override void Render(HtmlTextWriter writer)
    {
        Graph g = new Graph();
        g.Title = new Title("Bar Chart");
        var bar = new BarSketch(3);
        Random random = new Random();
        bar.Fillalpha = 0.4;
        bar.Text = "Test";
        bar.Fontsize = 10;
        int max = int.MinValue;
        for (int i = 0; i < 12; i++)
        {
            int value = random.Next(i, i * 2);
            if (value > max)
                max = value;
            var val = bar.NewValue(i.ToString(), value);
            bar.Values.Add(val);
        }
        g.AddElement(bar);
        g.OnBuildComplete();
        writer.Write(g.ToPrettyString());
    }
}

This approach is useful for web farms.

If you made a bug in the JSON you’ll have the most common Error #2032 which means that the data for the chart can not be loaded. To solve it the chart has properties DataHandlerUrl and SpecificDataHandler and you can exactly specify the HttpHandler or the specific data handler address.

Related posts: Open Flash Chart

Submit this story to DotNetKicks

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

I just wanted to publish the theme which I originally used to create this blog. The template was taken from www.freecsstemplates.org. I liked it because of complete simplicity, 2 column layout and a lot of air in text. See this post using the theme.

The theme is now adapted for the BlogEngine.Net 1.4.5. The new preview fitures in comments view like preview tab and bb code buttons are avialable. I've tested it using firefox and IE 6, 7 and it is even XHTML 1.0 compliant but nobody is perfect and if you have any problems send a message to me.

I've found that it is rather simple to adapt any CSS template for the BlogEngine.Net. The Al Nyveldt article and greate webcast describes how to do it in very simple way that everyone with basic CSS and ASP.NET experience can do it himself.

The original CSS template was released under the Creative Commons Attribution 2.5 license. My modification can be considered as BSD license.

SimpleTex.zip (22.88 kb)

Submit this story to DotNetKicks

Posted in:   Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5