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 262711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:32:26+00:00 2026-05-11T22:32:26+00:00

I have a line chart that is updated every so and so seconds, similar

  • 0

I have a line chart that is updated every so and so seconds, similar to the one you see in Windows’ Task Manager. The chart goes right-to-left, with the most recent data on the right, and going leftwards. How would I invert the values of the X axis so that the lowest value is on the right and the highest on the left? It’s a LinearAxis.

I tried making it a CategoryAxis and putting the numbers in manually, but that doesn’t work the way it should (the labels are not aligned with the ticks).

Or, is there a way to have the labels in a CategoryAxis align with the ticks?

  • 1 1 Answer
  • 2 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-11T22:32:26+00:00Added an answer on May 11, 2026 at 10:32 pm

    So I’ve looked into it an i also can’t see a straightforward way of flipping the axis. However i do have a solution that would work perfectly well and is relatively elegant giving the omission of a property to do this for you.

    So consider this normal left-to-right line chart (should just be able to copy and paste this into a project to test).

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[          
            import mx.collections.ArrayCollection;
    
            [Bindable]
            private var timeValue:ArrayCollection = new ArrayCollection( [
                { Time: 0, Value: 18 },
                { Time: 1, Value: 20 },
                { Time: 2, Value: 30 },
                { Time: 3, Value: 35 }, 
                { Time: 4, Value: 35 }, 
                { Time: 5, Value: 32 }, 
                { Time: 6, Value: 40 }, 
                { Time: 7, Value: 62 }, 
                { Time: 8, Value: 80 },
                { Time: 9, Value: 75 },
                { Time: 10, Value: 76 } ]);
            ]]>
        </mx:Script>
    
        <!-- Define custom colors for use as fills. -->
        <mx:SolidColor id="sc1" color="yellow" alpha=".8"/>
    
        <!-- Define custom Strokes for the columns. -->
        <mx:Stroke id="s1" color="yellow" weight="2"/>
    
        <mx:Panel title="ColumnChart and BarChart Controls Example" 
            height="100%" width="100%" layout="horizontal">
            <mx:LineChart id="column" 
                height="100%" 
                width="100%" 
                paddingLeft="5" 
                paddingRight="5" 
                showDataTips="true" 
                dataProvider="{timeValue}" >
    
                <mx:horizontalAxis>
                    <mx:LinearAxis maximum="10" minimum="0"/>
                </mx:horizontalAxis>
    
                <mx:verticalAxis>
                    <mx:LinearAxis maximum="100" minimum="0" />         
                </mx:verticalAxis>
    
                <mx:series>
                    <mx:LineSeries 
                        xField="Time" 
                        yField="Value" 
                        displayName="TimeValue"
                        fill="{sc1}"
                        stroke="{s1}"
                    />
                </mx:series>
            </mx:LineChart>
    
        </mx:Panel>
    </mx:Application>
    

    To change this to a right-to-left chart, i do some inverting of the time values to make them negative and then plot them along an axis that uses a negative minimum and zero as the maximum. I also then run a function on the labels to make them positive again to fit the original data source.

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                import mx.charts.chartClasses.IAxisRenderer;          
                import mx.collections.ArrayCollection;
    
                [Bindable]
                private var timeValue:ArrayCollection = new ArrayCollection( [
                    { Time: 0, Value: 18 },
                    { Time: 1, Value: 20 },
                    { Time: 2, Value: 30 },
                    { Time: 3, Value: 35 }, 
                    { Time: 4, Value: 35 }, 
                    { Time: 5, Value: 32 }, 
                    { Time: 6, Value: 40 }, 
                    { Time: 7, Value: 62 }, 
                    { Time: 8, Value: 80 },
                    { Time: 9, Value: 75 },
                    { Time: 10, Value: 76 } ]);
    
                private function verticalAxisParseFunction(value : Number) : Number
                {
                    return value * -1;
                }
    
                private function horizontalAxisRenderedLabelFunction(axisRenderer:IAxisRenderer, label:String):String
                {
                    var labelAsNumber : Number = Number(label);
    
                    if (isNaN(labelAsNumber))
                    {
                        return label;
                    }
    
                    return (labelAsNumber * -1).toString();
                }
    
            ]]>
        </mx:Script>
    
        <!-- Define custom colors for use as fills. -->
        <mx:SolidColor id="sc1" color="yellow" alpha=".8"/>
    
        <!-- Define custom Strokes for the columns. -->
        <mx:Stroke id="s1" color="yellow" weight="2"/>
    
        <mx:Panel title="ColumnChart and BarChart Controls Example" 
            height="100%" width="100%" layout="horizontal">
            <mx:LineChart id="column" 
                height="100%" 
                width="100%" 
                paddingLeft="5" 
                paddingRight="5" 
                showDataTips="true" 
                dataProvider="{timeValue}" >
    
                <mx:horizontalAxis>
                    <mx:LinearAxis id="horizontalAxis" maximum="0" minimum="-10" parseFunction="{verticalAxisParseFunction}"/>
                </mx:horizontalAxis>
    
                <mx:verticalAxis>
                    <mx:LinearAxis id="verticalAxis" maximum="100" minimum="0" />           
                </mx:verticalAxis>
    
                <mx:horizontalAxisRenderers>
                    <mx:AxisRenderer
                        axis="{horizontalAxis}"
                        labelFunction="{horizontalAxisRenderedLabelFunction}" />
                </mx:horizontalAxisRenderers>
    
                <mx:verticalAxisRenderers>
                    <mx:AxisRenderer
                        axis="{verticalAxis}"
                        placement="right" />
                </mx:verticalAxisRenderers>
    
    
                <mx:series>
                    <mx:LineSeries 
                        xField="Time" 
                        yField="Value" 
                        displayName="TimeValue"
                        fill="{sc1}"
                        stroke="{s1}"
                    />
                </mx:series>
            </mx:LineChart>
    
        </mx:Panel>
    </mx:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple JSF line chart that uses PrimeFaces (via jqPlot) library: <p:lineChart
I have created a line chart using Reporting Services that charts the number of
I am using below URL to show line chart but one thing I have
I have a chart on a Windows Form with several line graphs. I would
I have a line series chart called lineSeries1. I would like that chart to
I have a chart in excel that represents some value over a one day
I'm trying to define an applet with a chart that have to be updated
I have a line chart in a report (rdlc), that I cannot get formatted
For example we have this line chart at Google Code API there is a
I have made a simple Line Chart: Which is showing 4 grid-lines at points

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.