Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7406247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:31:40+00:00 2026-05-29T05:31:40+00:00

first question here. I have a BarChart showing several normal bars and a BarSeries,

  • 0

first question here.
I have a BarChart showing several normal bars and a BarSeries, like this:

<mx:BarChart id="barchart" dataProvider="{model.myList}" type="clustered">
    <mx:horizontalAxis>
        <mx:LinearAxis autoAdjust="true"/>
    </mx:horizontalAxis>
    <mx:verticalAxis>
        <mx:CategoryAxis categoryField="name"/>
    </mx:verticalAxis>
    <mx:series>
        <mx:BarSeries dataProvider="{model.myList}" xField="myValue"/>
    </mx:series>
</mx:BarChart>

When a user clicks on a button, i need to calculate some values, put them on the “myCalculatedValue” and add another BarSeries as a comparison. I’m doing this:

var barSerie:BarSeries = new BarSeries();
barSerie.dataProvider = model.myList;
barSerie.xField = "myCalculatedValue";
barchart.series.push(barSerie);

But the BarChart does not change at all. Is there some way to refresh the chart after adding the new BarSeries?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:31:40+00:00Added an answer on May 29, 2026 at 5:31 am

    The short answer is to use this code:

    var barSerie:BarSeries = new BarSeries();
    barSerie.dataProvider = model.myList;
    barSerie.xField = "myCalculatedValue";
    var allSeries:Array = barchart.series;
    allSeries.push(barSerie);
    barchart.series = allSeries;
    

    The LONG answer, to give you an understanding of how this works:

    The way flex knows when to refresh a ui component that is data backed, such as a chart, is on the function set dataProvider property, or equivalent (in this case series).

    Here is the code from mx.charts.chartClasses.ChartBase:

    public function set series(value:Array /* of Series */):void
    {
        value = value == null ? [] : value;
        _userSeries = value;
    
        var n:int = value.length;
        for (var i:int = 0; i < n; ++i)
        {
            if (value[i] is Series)
            {
                (value[i] as Series).owner = this;                
            }
        }
    
        invalidateSeries();
        invalidateData();
        legendDataChanged();
    }
    

    Notice that the relevant “invalidate” methods are called at the end of the set method.
    If you say barChart.series.push(x), the set series method is never called, only the getter. Therefore in order to force the chart to know there was a change to the series, you need to assign a new value to the series.

    It is worth pointing out that even assigning the series to itself will cause an invalidate, although it isn’t good coding
    barChart.series = barChart.series

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings to all! This is my first question here on stackoverflow. I have a
this is my first question.. so, here we go. i have a site, 100%
Sorry, this's my first time to ask a question here. So, I don't have
this is my first time posting here, I have a question which I have
This is my first question here :) I have an array with a number
Hey stackoverflow - This is my first question here. I have 2 tables in
it's my first question here, glad to have found this site. My question deals
this is my first question here in stackoverflow. I have two processes, a root
this is my first question here. I have the following jquery code: $(document).ready(function(){ $(a).click(function(){
This is my first question here. I have been searching Stack Overflow and other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.