views:

1202

answers:

1

Hi all,

I am using open flash chart to display a chart in my page.I am using the below code to display the line chart data to my page.

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "530", "250","9.0.0", "expressInstall.swf",
{"data-file":"data.json"}
);
</script>

and my json file is as follows

{

  "y_legend":{
        "text": "Price US$",
         "style": "{color: #53B9AA;font-size:20; }"
            },

  "elements":[
   {
   "type": "line",
   "colour": "#53B9AA",
    "bg_colour": "#E58A25",
    "background-color":"#53B9AA",
    "inner_background": "#E58A25",
    "text": "Price History",
    "font-size": 19,
    "width": 1,
    "dot-style": {
    "type":"solid-dot", "colour":"#F57F22", "dot-size": 3,
         "tip":"Average price: #val#<br>#x_label#" },
         "on-show": {"type": "shrink-in", "cascade":1, "delay":0.7},
          "values" : [
                 5,7,10,12,13,{"value":11,"colour":"#53B9AA","tip":"Average price :  #val#<br>#x_label#"},
  10,9,8,7,6]
}
],

  "x_axis":{
  "colour": "#7CC8B5",
  "text": "Price US$",
  "labels": {
  "rotate": "vertical",
  "labels":["Jan-09","Feb-09","Mar-09",
  "Apr-09","May-09","Jun-09",
  "Jul-09","Aug-09","Sep-09",
  "Oct-09","Nov-09","Dec-09",
  "Jan-10","Feb-10","Mar-10"]
  }
 },

 "y_axis":{
 "stroke": 4,
  "tick-length": 10,
  "colour": "#7CC8B5",
  "grid-colour": "#ADB5C7",
   "grid-visible": true,
   "offset": false,
    "min": 5,
     "max": 20,
     "visible": true,
     "steps": 5
   }
}

The chart is rendering in my browser pretty well.Now i want to add some more data to chart.Basically my chart is displaying the average sales for past few months.I want to show the projected /forcasted/future data also.I can pass that data to the jSON file.I want the future data to be in a different color in the chart.and i want to display the legends too in the top of the chart to indicate which one is current data and which one is future data.

Thanks in advance.

A: 

The solution is to use different lines for the current and projected data.

You can add multiple lines to a single chart, but this might not suit your purposes, since (currently at least), line charts need to have data for the whole x-axis range, and any null values are interpolated.

One option is to use the patched version from this site, set null-gap:true and use null data values to pad the line positions.

The option is to use the normal version of the flash object and use scatter charts as in this example: http://teethgrinder.co.uk/open-flash-chart-2/scatter-mixed.php

therefromhere