Help !!! - Dynamic adding and removing lineseries from flex chart....

598 views
Skip to first unread message

vàppý

unread,
Jul 24, 2008, 12:00:43 AM7/24/08
to Flex India Community
My App displays a chart with multiple series depending upon the
checkboxs that are checked. so i require to add and remove the series
of data onto the chart.

Here's the function I tried use to add series to the chart... but the
series doesn't get added to the chart.. Is there something wrong with
the code.

public function add_series():void
{
var ls:LineSeries;
ls = new LineSeries();
ls.xField = "date";
ls.yField = "value";
ls.dataProvider = mainData;
mainChart.series.push(ls);
mainChart.invalidateSeriesStyles();

}

thanks in advance ....

Venkat Viswanathan

unread,
Jul 24, 2008, 2:19:17 PM7/24/08
to flex_...@googlegroups.com
Hi,

This may sound silly but it may work... try doing this:


 public function add_series():void
                       {
                               var ls:LineSeries;
                               ls = new LineSeries();
                               ls.xField = "date";
                               ls.yField = "value";
                               ls.dataProvider = mainData;
                               var tmp:Array = mainChart.series;
                               tmp.push(ls)
                               mainChart.series = tmp;
                               mainChart.invalidateSeriesStyles();
                      }

Let me know if this worked.

Regards,
Venkat

vàppý

unread,
Jul 25, 2008, 12:08:15 AM7/25/08
to Flex India Community
Hey it worked !!! :) :) Thanks a lot...

Regards,
Vignesh

On Jul 24, 11:19 pm, "Venkat Viswanathan" <helloven...@gmail.com>
wrote:
> Hi,
>
> This may sound silly but it may work... try doing this:
>
>  public function add_series():void
>                        {
>                                var ls:LineSeries;
>                                ls = new LineSeries();
>                                ls.xField = "date";
>                                ls.yField = "value";
>                                ls.dataProvider = mainData;
>                                var tmp:Array = mainChart.series;
>                                tmp.push(ls)
>                                mainChart.series = tmp;
>                                mainChart.invalidateSeriesStyles();
>                       }
>
> Let me know if this worked.
>
> Regards,
> Venkat
>
Reply all
Reply to author
Forward
0 new messages