Open Flash Charts

I was browsing WebAppers the other night to see what I’ve been missing in the wonderful ‘Web 2.0’ world (I really hate that term) when I stumbled upon Open Flash Charts. I just had to check this thing out. There’s another Flash based charting software I’ve been using for a side project of mine. It’s actually fairly cheap at $50 per domain. But I figure I’d give this Open Flash Charts thing a try and see if it’s a good replacement. One of the features I’m in need of is ‘live’ data– where the charts update on the fly at some variable interval without a full page reload. Obviously so you can see ‘live’ data as your database tables are being populated. Open Flash Charts has just the thing using Javascript/AJAX. The developer makes note that the AJAX API is experimental and may change, but for now I have something that works. So here’s what I came up with. Click here for a demo

You should be able to download the OFC project and be able to throw this together in a matter of minutes. It was actually a lot easier than I had original thought. A more elegant way of making this work would be to use Prototype or MooTools or any of the other Javascript frameworks as they have Periodical Executers of some sort.

, , , ,

4 Responses to “Open Flash Charts”

  1. the-di-lab February 7, 2009 at 10:40 pm #

    I found a bug in IE 7 in in your demo.
    My fix is to replace findSWF function with

    function findSWF(movieName) {
    if (navigator.appName.indexOf(“Microsoft”)!= -1) {
    //return window[“ie_” + movieName];
    return document.getElementById(‘ie_’+movieName);
    } else {
    //return document[movieName];
    return document.getElementById(movieName);
    }
    }

  2. rasel July 22, 2010 at 9:23 am #

    can anybody help. i had js error in ajax charts.
    “tmp.reload is not a function”
    anybody had similar error?

  3. acp2929 June 20, 2011 at 1:19 pm #

    Hello Timothy,

    Actually works! thanks for your post and..

    ..currently I have a question. I am trying to make appear two graphics in the same web page, but I can’t do it. Please could you me advising what could be the possible solution? Thanks in advance. Alex.

    var timerID = 0;
    var timerID_1 = 0;

    function reload()
    {
    if (timerID)
    {
    clearTimeout(timerID);
    }

    tmp = findSWF(chart);
    x = tmp.reload(data.php);

    timerID = setTimeout(reload(), 3000);
    }

    function reload_1()
    {
    if (timerID_1)
    {
    clearTimeout(timerID_1);
    }

    tmp_1 = findSWF_1(chart_1);
    x_1 = tmp.reload_1(bar.php);

    timerID_1 = setTimeout(reload_1(), 3000);
    }

    function findSWF(movieName)
    {
    if (navigator.appName.indexOf(Microsoft)!= -1)
    {
    return window[movieName];
    }
    else
    {
    return document[movieName];
    }
    }

    function findSWF_1(movieName)
    {
    if (navigator.appName.indexOf(Microsoft)!= -1)
    {
    return window[movieName];
    }
    else
    {
    return document[movieName];
    }
    }

    timerID = setTimeout(reload(), 3000);
    timerID_1 = setTimeout(reload_1(), 3000);

  4. vandita.kenjale August 24, 2012 at 2:24 am #

    Hi Timothy,

    I was wondering if you have worked on any more examples with AJAX/JS for live data visualization using Open Flash Charts?
    And if you could share some sample code.
    In my scenario,I will be fetching data from the database and displaying it on the page with automatic updates on the chart.

    Appreciate your help!

    -Vandita.

Leave a Reply