Scaling of the x-axis on LineCharts

Hello everyone,
I'm working on using a LineChart to display incoming temperature readings from an embedded device and so far it's working very nicely, but I'm hoping someone can help me with one small problem I'm having.
I build an ArrayCollection of the temperature readings, including a timestamp of when the reading was received using a Date object, which is then used as the dataProvider for my LineChart.  The vertical axis is plotted correctly, but readings are plotted evenly-spaced on the horizontal axis even though readings are not made at regular time intervals.
For example, if I received a reading at 1 minute, 2 minutes, and 35 minutes, the three temperatures would be evenly spaced on the horizontal axis.  I want the horizontal axis to accurately represent the time frame of the readings received, so that with the previous readings there would be two points very close to the left hand of the horizontal axis and a single point plotted much further away.
I seem to be having trouble explaning this clearly so here is a quick sketch I made of the situation:
Thank you so much in advance for your help!
Sincerely,
Tom Morrisey
Diversified Control, Inc.

Hi,
         Set the interval for Horizontal axis with minInterval and Max Interval
<mx:LineChart id="chart" dataProvider="{arr}">
        <mx:series>
            <mx:LineSeries yField="Y" xField="X" >
            </mx:LineSeries>
        </mx:series>
        <mx:horizontalAxis>
            <mx:LinearAxis interval="2" minimum="0" maximum="40" />           
        </mx:horizontalAxis>
    </mx:LineChart>

Similar Messages

  • Non uniform intervals in the X-axis of LineChart

    Hi,
    I am using a Flex3 Line chart which takes data from an External XML file.
    But I dont get the DataTip points correctly if i give some numeric values in the X values and
    even then, the values in the X-axis starts from the "0"th position and the interval between the "0"th & 1st value (in X axis) is half of the others (shown in red bar in the attached image) and also for the last one.
    How to have the uniform intervals in the X-axis so that the DataTip shows correct values as in the data?
    Below is the MXML & the XML I use:
    The MXML:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" backgroundColor="0xFFFFFF" creationComplete="fetchData();">
    <mx:HTTPService id="myServ" url="TempChartData.xml" fault="faultHandler(event)"/>
    <mx:Script>
    <![CDATA[
         import mx.controls.Alert;
         import mx.rpc.events.*;    
         import mx.controls.ToolTip;
         //Trigger the HTTPService to fetch data from the back-end
         public function fetchData():void
              myServ.send();
         public function faultHandler(event:FaultEvent):void
              Alert.show(event.fault.message);
    ]]>
    </mx:Script>
    <mx:LineChart id="myChart" width="100%" height="100%" showDataTips="true" dataProvider="{myServ.lastResult.tasks.task}">
         <mx:horizontalAxis>
              <mx:CategoryAxis id="myHorzAxis" categoryField="name" title="My Tasks"/>
         </mx:horizontalAxis>
         <mx:verticalAxis>
              <mx:LinearAxis title="My Data Values"/>
         </mx:verticalAxis>
         <mx:horizontalAxisRenderers>
              <mx:AxisRenderer axis="{myHorzAxis}" labelRotation="45"/>
         </mx:horizontalAxisRenderers>
         <mx:series>
              <mx:LineSeries id="myLineSeries1" xField="name" yField="Value">
              </mx:LineSeries>
         </mx:series>
    </mx:LineChart>
    </mx:Application>
    TempChartData.XML
    <?xml version="1.0" encoding="utf-8"?>
    <tasks usl="25" lsl="-75">
        <task name="1">
            <Value>-115</Value>       
        </task>
        <task name="2">
            <Value>-112</Value>       
        </task>
        <task name="3">
            <Value>-100</Value>       
        </task>   
        <task name="4">
            <Value>0</Value>       
        </task>
        <task name="5">
            <Value>-74</Value>       
    </task>
        <task name="6">
        <Value>0</Value>
        </task>
        <task name="7">
        <Value>-67</Value>
        </task>
    </tasks>

    Please do not post VIs with infinite loops (at least without informing us that they work that way)! The loop should have a stop button on the front panel wired to the stop terminal in the loop. If you use the Abort button to stop the VI, the file never gets closed.
    A long time Forum participant has said that: "Using the Abort button to stop a VI is like using a tree to stop a car. It works but may have unintended consequences!"
    To get the format you want after reading you need to convert the first column in the spreadsheet file from a date-time string to a numeric which can be interpretted by the graph as a timestamp. With the format you have chosen for the file it is somewhat complicated. Spend some time reading the detailed help for the timestamp and string format functions.
    In the VI attached the file is read as string. The first column is separated into 7 numerical values to create a date-time record (cluster) which is then converted to a timestamp and then to DBL. The second column is converted to an array of DBL. The arrays are bundled and connected to an XY graph. The graph X-Axis is formatted as Absolute Time, AM/PM, HH:MMS. You can add the fractional seconds if you want but the scale starts to get crowded.
    Also, the error out wires from the property nodes used to initialize the graphs should be wired to the loop to assure that they execute first.
    Lynn
    Attachments:
    test_3.2.vi ‏26 KB

  • Log scaling intesity chart y-axis

    is it possible to change the scaling of the y-axis on an intesity chart to log scaling?

    Hi DNyg,
    This is actually a known issue in LabVIEW and CAR (corrective action request 372856) has been submitted to our research and development team. I have gone ahead and added this post to the CAR so they can see that more people have encountered this issue. In the meantime, a potential work-around would be to manually scale your Y-axis data logrithmically before wiring it into your intensity chart.
    Paul C
    Applications Engineer

  • Java FX linechart reloading does not load the category axis in sorted order

    We are reloading the different data in Java FX line chart for . First time it loads with sorted order and looks good but we try to reload again and again the category axis sorting messed up and does not display in order. I did try even with Number axis but no luck.
    Any pointers why the first time able to load but not later....
    I am removing the series and recreating the series instance before loading the chart but no luck.
    lineChart.getData().removeAll(series1)
    Appreciate for any pointers.

    Please supply an executable sample

  • Scaling the cwgraph axis

    Hi Everybody,
    i´m new in here and i have a problem!
    So i´m using the PCI6014 card for my measurement and Borland Delphi7.
    I´m using a CwGraph to plot the measured graph from my pressure sensor. Now i would like to scale the axis:
    x-axis= Time (seconds)
    y-axis= Pressure (mmHg)
    The Pressure-Axis should show the Value which is measured and the time-axis should show the time currently.
    I hope that i describe my problem well!
    Can someone help me, or say where i can find something about this?
    Thanks

    You can format the X axis for time with the usual notation hh:mm:ss or, for long lasting tests, you can format it in a date+time manner.
    To obtain the first representation (time only), right-click on the axis and choose Formatting... in the popup menu. In the panel that appears (X Scale Formatting) there is a box in the lower right corner: inside the box you will find the "Relative time (seconds)" option that permits you to format the X axis in time instead of pure numbers.
    Once shown in time, you can still adapt the scale clicking on a label shown and writing either the number of seconds since midnight or the corresponding hh:mm:ss string. Example: to set the initial point of the scale to 12 o'clock, double click on the first label of the x axis and t
    ype "43200" or "12:00:00": the axis will be rescaled showing 12:00:00 as the initial label.
    The second option (X axis with date and time format) is obtained putting 'Time & Date' in the Format parameter inside the X Scale Formatting panel. You can customize date and time portions separately.
    Hope this helps
    Roberto
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Problem with the Z axis...blurred objects...what'd I miss?

    Howdy,
    I've got some vector objects in Flash that start out real small--like 20-30 pixels square. When I change their position on the Z axis to 'zoom in' on them, the larger they get, the blurrier they get.
    When I just tween the x/y size, and not move the z axis they look fine.
    For example draw a 20x20 square on the stage.
    Convert it to a movie clip so that I can 3D it.
    Scale it up to 300 pixels.
    Looks fine.
    Adjust the Z axis by 1.
    Blllluuuurrrrrrrrr.
    Did I miss a setting somewhere or is this just a limitation that needs to be worked around?
    Thanks in advance,
    -Ted

    Rothrock, Excellent link, thanks for that! Have some points.
    After reading it:
    crap.
    Looks like I need to learn about hand coding the 3d effects, or using scaling instead and adding switch when I need the z....
    Hmmm...that'll require a little mor coffee.

  • Stretching the Z axis

    Many 3D geological models and digital terrains are often viewed with an exaggerated z-axis to make subtle features more obvious.
    Is is possible in Acrobat 3d to exaggerate the z-axis? It would be great if the end-user of the pdf could adjust the vertical exaggeration to different values.
    Thanks

    Rothrock, Excellent link, thanks for that! Have some points.
    After reading it:
    crap.
    Looks like I need to learn about hand coding the 3d effects, or using scaling instead and adding switch when I need the z....
    Hmmm...that'll require a little mor coffee.

  • Combination Chart: How to link auto-scaling of both Y-Axis?

    I have a combination chart showing a couple bars and a couple lines.  The bars use the left Y-Axis and the lines correspond to the right Y-Axis.  Although they are based off seperate Y-Axis', the information is still related to each other.
    Under my combination chart i have a slider which increases/decreases a 3rd set of red bars and it can push them so high that the Y-Axis will auto-scale itself, which is great.  But what happens is the secondary Y-Axis will not also re-scale to go wth the primary Y-Axis.  I have 2 screenshots to help demonstrate things a bit better.  So although the information is still technically correct, it is visibly incorrect.  Is there a way to link these 2 Axis together so it knows the max on the left Y-Axis before touching the slider is related to the max on the right Y-Axis? So if the primary y-axis grows, the secondary needs to as well?
    PICTURES
    The slider adjusts the red bars and i put them all the way up just before the point where it re-scales the primary y-axis:
    http://img38.imageshack.us/img38/7853/beforel.jpg
    Now i cranked the slider all the way up and the primary y-axis rescaled itself but the bars still look the exact same in relation to that blue line running across them.  The 2 lines on the graph that use the right y-axis should have dropped lower at the same time the blue/yellow bars did:
    http://img602.imageshack.us/img602/7996/afters.jpg
    Thanks for the help, I appreciate it!

    Hi Scott,
    You can control the scaling on the secondary Y axis. Find the maximum of the data for line as well as the column chart (here you can take help of MAX() excel formula) then take the maximum value out of the result and that cell storing data from slider. In this way we can find out the largest data among all. Use that data as the maximum limit for primary as well as for secondary axis,
    Go to the Behavior tab of the chart > primary scale > maximum limit > elect the cell containing the calculated maximum value.
    Repeat the same steps for secondary axis also. Now the change in one series will have uniform effect on both the axis.

  • Changing the x axis

    Hi everyone.
    I have done an fft in lab view signal express, but the x axis shows the frequency (Hz).
    I need it to show the range.
    I have the formulae to change the x axis, but i am not sure on how this can be done!.
    the formuale is range = freq *c*dT/(2*dF)
    Where dT = 0.02
    and dF = 66*10^6
    c = 3*10*8.
    how can i get the range on the x axis.
    many thanks.

    Right-click the graph and select Properties.
    Then go to the Scales tab.
    The drop down box shows by default the X-axis, so that's ok
    If you need another scale, select it first.
    On the same tab you also see Scaling factors Offset & Multiplier.
    Calculate both to convert what you have now to what you want
    I won't do the math's for you
    Enter the two values and
    Then click the Ok button.

  • Reversing the x-axis

    Hi,
    By default, the x-axis in Java 3D runs from left to right. Does anyone know of a way to change this so that the x-axis runs from right to left?
    Thanks

    I think you can use setScale for a non-uniform scaling, so you would use -1.0 , 1.0 , 1.0 , this would essentially be a mirror effect. Careful here, since your axes would no longer obey right hand rule, probably you could flip more than the x-axis to get the desired coord system you are shooting for.

  • How can I change the Y axis to show my values in a descending order in Numbers. eg zero at the top and the maximum value at bottom?

    Hi,
    I'm just about getting to grips with Numbers, but I'm stumped at the moment with this problem.
    I want to show zero at the top on the (y) axis, as zero is the goal and 100 is the starting point?
    can it be done? i would really appreicate some help on this.
    Kind regards
    Rob

    Is it so difficult to read given answers ?
    Barry described the correct scheme.
    In the table "to_chart", the cell A1 contains :
    =ROUNDUP(ABS(MIN(Tableau 1 :: B:E))/10,0)*10
    The cell B2 embed the formula :
    =$A$1+Tableau 1 :: B2
    Apply fill down and fill to the right.
    On the left edge, the colored rectangle is a text block in which I inserted the label values.
    Of course if you dislike this scheme, you are perfectly free to use an other application.
    Yvan KOENIG (VALLAURIS, France) lundi 4 juillet 2011 14:37:56 iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • I want the minimum of the horizontal axis to be the first day of the month.

    I have a situation where I want the minimum of the horizontal
    axis(with date time axis) to be the first day of the month. I
    attempt it like so:
    var max:Date = new Date();//current date is our max from
    which we will calculate the min
    var min:Date = new Date(max.fullYear,max.month,1);
    dateTimeAxis.minimum = min;
    However this first date on this axis is the last day of the
    previous month for example 31 August instead of 1 September. Any
    ideas how to fix?

    Nikos, the only thing I can think of (off hand) is that it's
    defaulting to "zero" hour on that date, if you tried:
    var min:Date = new Date(max.fullYear,max.month,1,13);
    Would that make it work? That would set the date to 1pm.
    Have you considered defining the axis with the data you are
    binding to?
    Cheers,
    David

  • Motion Tween w/ Rotation Dropping on the Y Axis

    Is there a way to prevent a motion tween w/ rotation from dropping on the Y axis? Basically I used Free Transform to change the angle of a line, but it always lowers itself on the Y axis when I insert a motion tween in it.

    Hey there,
    The properties shouldn't be changing when you insert a motion tween. Could you either attach a file with the object *before* you create the tween, or let me know all the properties of the object before you insert the tween so I can try and reproduce internaly?  (X, Y, rotation, scale X/Y, skew X/Y).
    Thanks!
    Jen.

  • How can I use a timestring saved from LV as a csv spreadshee​t file as the x axis of a LV chart?

    I'm saving the timestring portion of a timestamp as HH:MMS  along with each set of data fields to a cvs spreadsheet file, i.e. each row of the file starts with the timestring followed by data in each remaining column. The first row contains data field headings. I can read this file back into LV with no problem and can remove the header row but cannot find a way to use that timestring as the x axis of a chart graph. I have no problem graphing the data in that format within Excel itself. Can anyone help?
    Thanks,
    DennisR

    Check the timestamp indicator, it is trying to write your time-stamp to your time-zone, so you will need to change the time-stamp to universal time. For the time-stamp indicator it is easy enough you just need to edit the indicator to display universal time, however for a purely data sense it is a bit odd, I have never found a straight forward way to do it so I use the conversion between Time in Seconds and Date/Time to do it for me.
    Attachments:
    Time Extract.png ‏21 KB

  • Crystal Reports - Charts - Restricting the data points on the X-axis

    Hi,
    Is there a way to restrict the number of points to display on the x-axis of a crystal chart keeping the number of data points the same.
    For example, if the chart plots date vs value points and the data for the chart is from 1980 to 2009. This means the data points on the x-axis appear very close to each other.
    I need a way to show the chart with all data from 1980 to 2009 but limited x-axis labels. Is there a way to configure the number of labels to show on the x-axis.
    Thanks!

    Thanks for the answer.
    "Right click on one of the x axis labels and select Group (X) Axis Options...
    On the Layout tab there is an option to Skip Group Labels, check this and enter in the number of labels you want to skip". Is there a way to do this from a .NET client or via a formula field in Crystal itself. The data points is going to be dynamic, hence the requirement is to dynamically configure the "number of labels" to be skipped.
    Thanks.

Maybe you are looking for