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

  • SEARCH
  • Home
  • 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 6703465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:10:28+00:00 2026-05-26T07:10:28+00:00

I have a line chart in flex with a dateTime axis. I am setting

  • 0

I have a line chart in flex with a dateTime axis. I am setting the dataprovider to that linechart via actionscript. The graph gets drawn. The problem occurs when i assign a null to the dataprovider so that the graph becomes empty.

Actual code looks similar to the code below :

var actualValues:XMLList=flowChartDP.upFlows;
var localSeries1:LineSeries = new LineSeries();
localSeries1.dataProvider = actualValues;
localSeries1.yField = "flow";
localSeries1.xField = "time";
localSeries1.setStyle("form","curve");
var currentSeries1:Array =lineChart.series;
currentSeries1.push(localSeries1);
lineChart.series = currentSeries1;
var actualValues2:XMLList=flowChartDP.downFlows;
var localSeries2:LineSeries = new LineSeries();
localSeries2.dataProvider = actualValues2;
localSeries2.yField = "flow";
localSeries2.xField = "time";
localSeries2.setStyle("form","curve");
var currentSeries2:Array =lineChart.series;
currentSeries2.push(localSeries2);
lineChart.series = currentSeries2;

And I will be adding two more series exactly in the samefashion to the lineChart.Although i guess not the best way of writung the code this one works fine.
The problem is with resetting the graph.

I have a button which when clicked does:
lineChart.dataprovider=null;
lineChart.series=null;

But my flash player(FP 10 debugger version) throws up the following error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.charts::AxisRenderer/measureHorizontalGutters()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\AxisRenderer.as:2275]
    at mx.charts::AxisRenderer/calcRotationAndSpacing()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\AxisRenderer.as:1889]
    at mx.charts::AxisRenderer/adjustGutters()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\AxisRenderer.as:1565]
    at mx.charts.chartClasses::CartesianChart/updateAxisLayout()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\chartClasses\CartesianChart.as:2133]
    at mx.charts.chartClasses::CartesianChart/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\chartClasses\CartesianChart.as:1391]
    at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8531]
    at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:663]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

What is the solution? It doesn’t throw the error when

lineChart.series=null;

is removed. But the statement

lineChart.dataprovider=null;

doesnt make the chart empty either.

  • 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-26T07:10:28+00:00Added an answer on May 26, 2026 at 7:10 am

    Below is a simple application I created to re-create your issue. Setting the dataProvider to null does clear the chart without any exceptions for me. Run it and see. I say your problem is somewhere else.

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
       xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark"             
       xmlns:mx="library://ns.adobe.com/flex/mx" >
    
        <fx:Script><![CDATA[
    
            import mx.collections.ArrayCollection;
            [Bindable]
            public var expenses:ArrayCollection = new ArrayCollection([
                {Month:"Jan", Profit:2000, Expenses:1500, Amount:450},
                {Month:"Feb", Profit:1000, Expenses:200, Amount:600},
                {Month:"Mar", Profit:1500, Expenses:500, Amount:300}
            ]);
    
    
            protected function button1_clickHandler(event:MouseEvent):void
            {
                myChart.dataProvider = null;
    
            }
    
        ]]></fx:Script>
    
        <s:layout>
            <s:VerticalLayout />
        </s:layout>
    
    
        <mx:Panel title="Line Chart">
            <mx:LineChart id="myChart" 
                          dataProvider="{expenses}" 
                          showDataTips="true"
                          >
                <mx:horizontalAxis>
                    <mx:CategoryAxis 
                        dataProvider="{expenses}" 
                        categoryField="Month"
                        />
                </mx:horizontalAxis>
                <mx:series>
                    <mx:LineSeries 
                        yField="Profit" 
                        displayName="Profit"
                        />
                    <mx:LineSeries 
                        yField="Expenses" 
                        displayName="Expenses"
                        />
                </mx:series>
            </mx:LineChart>
            <mx:Legend dataProvider="{myChart}"/>
        </mx:Panel>
    
        <s:Button click="button1_clickHandler(event)" label="Clear" />
    
    </s:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line chart that is updated every so and so seconds, similar
Ext-js Chart, I have a line graph, and I wish to add a single
I have line chart which has values : flock_age = X-axis = 16, 17,
How to show axis line for each bar in chart? I have line only
I have a line series chart called lineSeries1. I would like that chart to
I've created an ajax driven flot line chart that I would like to have
So I have a google line chart visualization with a data set that has
I have data that maps across ~4 years on a line chart: 0 72
I have a line chart in a report (rdlc), that I cannot get formatted
I have a C# windows form with a simple 2D line chart that I

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.