Java Fx Category Axis out of order

I have a chart where I REPLACE the data in a XY chart with new String,Number pairs and I get the category axis labels out of order. They retain part of the order of the previous chart that has had its data deleted.
Here is a demo app that shows the behavior. Just click on the chart a couple of times while looking at the x axis. The first time the data is plotted all is ok, after other data is plotted, the category axis gets screwed up for the original data.
Any help?????
Tom
package testCategoryBug;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.chart.XYChart.Series;
import javafx.scene.input.MouseEvent;
public class TestCategoryBug extends Application {
      static Boolean even=true;
    @Override public void start(Stage stage) {
        stage.setTitle("Test Category Bug");   
        final CategoryAxis xAxis = new CategoryAxis();
        final NumberAxis yAxis = new NumberAxis();
        xAxis.setLabel("Month");      
        final LineChart<String,Number> lineChart = new LineChart<String,Number>(xAxis, yAxis);      
        lineChart.setTitle("Stock Monitoring, 2010");    
        // Initialize some data for plotting.
         final Series<String, Number> plottablePairs  = new Series<String, Number>();
         final Series<String, Number> plottablePairs2 = new Series<String, Number>();
        for (int i = 0; i < 10; i++) {
            Data<String,Number> pair= new Data<String,Number>("Month "+i,10.0*i);
            plottablePairs.getData().add(pair);
        for (int i = 5; i < 10; i++) {
            Data<String,Number> pair= new Data<String,Number>("Month "+i,100.0-10*i);
            plottablePairs2.getData().add(pair);
        // add the first of the series
          final ObservableList<XYChart.Series<String, Number>> chartData=FXCollections.observableArrayList();;
          chartData.add(plottablePairs);
          lineChart.setData(chartData);
          // now on a mouse click, swap the data.  Click twice and see what happens
          lineChart.addEventHandler(MouseEvent.MOUSE_CLICKED,new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent e) {
                chartData.clear();
                if (even) {
                    chartData.add(plottablePairs2);
                } else {
                    chartData.add(plottablePairs);
                    // note that after this, the axis is screwed up.
                lineChart.setData(chartData);
                even=!even;
          // Put up the scene
          Scene scene  = new Scene(lineChart,800,600);
          stage.setScene(scene);
          stage.show();
    public static void main(String[] args) {
        launch(args);

Obviously you just posted a simple example to demonstrate the problem, so I don't know if this workaround works for your real application, but could you just replace the entire chart?
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.chart.XYChart.Series;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
public class TestCategoryBug extends Application {
  private boolean even = true;
  @Override
  public void start(Stage stage) {
    stage.setTitle("Test Category Bug");
    // Initialize some data for plotting.
    final Series<String, Number> plottablePairs = new Series<String, Number>();
    final Series<String, Number> plottablePairs2 = new Series<String, Number>();
    for (int i = 0; i < 10; i++) {
      Data<String, Number> pair = new Data<String, Number>("Month " + i,
          10.0 * i);
      plottablePairs.getData().add(pair);
    for (int i = 5; i < 10; i++) {
      Data<String, Number> pair = new Data<String, Number>("Month " + i,
          100.0 - 10 * i);
      plottablePairs2.getData().add(pair);
    final BorderPane root = new BorderPane();
    displayLineChart(root, plottablePairs, plottablePairs2);
    // now on a mouse click, swap the data. Click twice and see what happens
    root.addEventHandler(MouseEvent.MOUSE_CLICKED,
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            even = !even;
            displayLineChart(root, plottablePairs, plottablePairs2);
    // Put up the scene
    final Scene scene = new Scene(root, 800, 600);
    stage.setScene(scene);
    stage.show();
  private void displayLineChart(BorderPane root, Series<String, Number> plottablePairs, Series<String, Number> plottablePairs2) {
   final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Month");
    final NumberAxis yAxis = new NumberAxis();
    LineChart<String, Number> lineChart = new LineChart<>(xAxis, yAxis);
    lineChart.setTitle("Stock Monitoring, 2010");
    if (even) {
      lineChart.getData().add(plottablePairs2);
    } else {
      lineChart.getData().add(plottablePairs);
    root.setCenter(lineChart);
  public static void main(String[] args) {
    launch(args);

Similar Messages

  • 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

  • Problem with Pie chart, Store Procedure and Category Axis

    Hi All,
    I'm having a problem when i try to use a Pie Chart with a store procedure
    when Category Axis - Field value is "none", the chart appears, but the description say Undefined
    but when i put any field from store procedure, the chart doesn't show.
    when I try the same with a normal SQL statement, all data was displayed
    my store procedure only have 2 columns
    n - numeric
    state - text
    The Store Procedure and the SQL, returns the same data in the same order
    Thanks in advance
    Cristian

    Hi guys,
    I need guide on creating a system using store procedure, referring to this thread: JDBC System Connection VS BI JDBC System Connection
    Hope you can help me out.
    Thanks a lot,
    Sarah

  • Urgent - How to change Item category for Open Purchase Order

    Hi Team,
    Lil bit tricky issue.
    My client has asked us to change the existing Item Category values, Combinations, Category Set etc. Its been changed and uploaded successfully.
    The question here is how we need to handle the category for Open Purchase Order. How to update the same.
    Do we need to do manually or any other way ?
    Please advice
    Regarads,
    John

    Hi John,
    This is reallly a tricky issue!
    I guess you cannot change the category of an existing PO's.
    This field will be greyed out once we save the form...there were no profiles/other setups to enable this field.
    For all new PO's since you have changed the new category value that should not be a issue.
    Lets wait for some of our colleuges opinion.
    I guess PO cancel should be the final option if we dont hear any new work arounds.
    Thanks
    -Arif.

  • CQLServerTrace : out of order timestamp Error

    Hi everyone,
    When I try to run this command I am getting the error which I specified bottom, how can I solve this problem?
    is-total-order parameter was set to "True".
    This is a simple Helloworld Application
    channel parameters are default ( max threads and max size was set to 0
    11.1.1.7 Version
            SELECT
                           shortName, avg(price) as price
                      FROM
                           stockInputChannel [PARTITION BY shortName ROWS 3 RANGE 3 SLIDE 3]
                      GROUP BY
                           shortName
    <Apr 28, 2013 1:15:48 PM VET> <Emergency> <CQLServerTrace> <BEA-000000> <event timestamp is out of order timestamp0=1,367,171,106,000,000,000 timestamp1=1,367,171,103,357,000,000 event=22715375 : kind=E_PLUS tuple=Tuple(14886,25458514) 'obj=Stock21921411,3.3803851379397982,char[15]=FWGUKXDXBPSYGPB,1367171103357,char[5]=XTCFZ,1367171103357000000,byte[1],obj=PartitionNode25458617,' ts=1367171103357000000 totalOrderingGuarantee=true in PO_GROUP_AGGR#144
    oracle.cep.execution.SoftExecException: event timestamp is out of order timestamp0=1,367,171,106,000,000,000 timestamp1=1,367,171,103,357,000,000 event=22715375 : kind=E_PLUS tuple=Tuple(14886,25458514) 'obj=Stock21921411,3.3803851379397982,char[15]=FWGUKXDXBPSYGPB,1367171103357,char[5]=XTCFZ,1367171103357000000,byte[1],obj=PartitionNode25458617,' ts=1367171103357000000 totalOrderingGuarantee=true in PO_GROUP_AGGR#144
            at oracle.cep.execution.ExecException.OutOfOrderException(ExecException.java:154)
            at oracle.cep.execution.operators.GroupAggr.run(GroupAggr.java:780)
            at oracle.cep.execution.operators.ExecOpt.run(ExecOpt.java:1002)
            at oracle.cep.execution.operators.ExecOpt.run(ExecOpt.java:984)
            at oracle.cep.execution.operators.ExecOpt.run(ExecOpt.java:1062)

    Hi,
    I am using Oracle CEP 11.1.1.4.
    I am trying to understand pattern matchin feature therefore my examples are meaningless. I am producing data like that ( between 1-3 and printing to console ):
    00:00:00 Producer produced 1
    00:00:05 Producer produced 2
    00:00:10 Producer produced 1
    00:00:15 Producer produced 3
    00:00:20 Producer produced 3
    00:00:25 Producer produced 1
    Then I am looking for the data ( or you can think that as 1-2-3 ) that has been produced once and has not been produced within last 10 seconds.
    I am using system-timestamp channels.

  • Can we reverse the category axis in Design Studio 1.3 column charts?

    Hi All,
    In WebI, there is an option to reverse the category axis for charts.
    Do we have something similar in Design Studio? I have a requirement to reverse the order in which labels are appearing in the chart.
    Please do help.
    Thanks in advance for your response,
    Sarah

    Sarah,
    You can go to Edit > Initial View and change the sort.
    Would this work for you?

  • Keys out of order - reinstalling OS X or get Disk Warrior - Advice?

    My nightmare is below but before describing it, I'm at this point in the problem: using an IBM laptop I've already logged into my 800MHz Mac G4 using Target mode and extracted all important files using HFS Explorer. Now I need help on what to do next so that I can try to save myself from having to reformat the Mac's hard drive. The full story:
    I ran 5 Apple software updates (listed below with approximate versions from my recollection) and the Mac installed them fine but rebooted to a blank blue screen. The OS level before running these updates was v.10.4.10 ...
    Apple OS X version 10.4.11 update
    QuickTime v. 7.5.1
    Java Console update
    iTunes 8.0.1
    …and one other minor update program.
    ... after several reboots I found that the Mac was pretty much gone. The error message I got in verbose mode was: "keys out of order, (4, 726)". I started the Mac in Single User Mode and ran several variants of the fsck command (-y, -fy, etc.) about 4 times each and no dice - the message I always got was: "Rebuilding catalog B-tree"... followed by: "volume could not be repaired". The Mac will not boot from the Mac OS X CD and I already tried holding down the "C" key trick but no dice there either. The only thing I haven't tried yet is typing "boot cdrom" at the Apple Firmware prompt - and wanted to ask if anyone thinks this might actually boot the OS X CD (?)
    At this point my real question is how to preserve the programs & files on the Mac and get it back working, if possible, without having to reformat the hard drive. I did not purchase Disk Warrior because the Mac won't boot the OS X CD using the "C" key. The Mac will eject the CD tray and I can insert the OS X CD but the CD never spins up and the Mac spits the CD out and then shuts itself down. If the "boot cdrom" command will work in the Firmware, then purchasing Disk Warrior becomes an option. I see my options right now as the following. Anyone know which option is best to reduce the headache factor and save the wallet.
    1. If "boot cdrom" using Apple Firmware will in fact boot a CD, will using Disk Warrior preserve the Mac's installed programs (Adobe Suite CS2) once Disk Warrior creates the new hard drive volume?
    2. Use "boot cdrom" using Apple Firmware and re-install OS X (will Adobe Suite still be installed?) Yes, it's a legal copy of CS2 but the install CD is not at my house and will take a week to get.
    3. Reformat the hard drive, install OS X and reinstall Adobe Suite, reconfigure my wireless settings, etc. and all the other stuff you have to do after a hard drive has to be reformatted.
    4. Take it to the local Apple Store
    5. ??? Any other options out there ???
    Thanks in advance.
    RPQ

    Thank you for the replies. Here is the final outcome on this one: a bad hard drive. The verdict from a local Apple authorized service center was that it was a coincidence that the hard drive (made in 2001) pretty much failed at the point when I was running the 5 updates. On their test bench, my Mac would not boot from the OS X CD or a DiskWarrior CD, but, it would boot from an external hard drive. I was told the CD-ROM drive and hard drive are on separate buses so the service provider did some testing with a new hard drive and the old hard drive. They were straight with me and everything they tried made sense because they were the same problems that I encountered when trying to fix/diagnose the Mac. In the end, they installed a new 250GB hard drive, installed OS 10.4.6 and gave me the old hard drive back – on which I still can access all the old files just in case I missed any with my original copy job to my laptop using HFS Explorer. $169 total bill. Not bad.
    I still think there is probably a way to clone the old hard drive but that could have run up the labor charges and by that time I could have purchased another entire (used) G4. So the only real loss is not having the Adobe CS2 suite of programs installed but I can still get the install disk if needed. Now sitting in my update list is: the Apple update to OS 10.4.11… the minimum OS system requirement to get a brand new Nano to work on a Mac. My fear is that running that update might cause the same Keys out of Order issue on this ol’ Mac so I’m thinking that I’m not going to install any more updates – just in case!

  • Multiple Selections on Category Axis

    Hi,
    I need to create a graph. On Category Axis ( X= axis)  I need to show values of 5 keyfigures from a BW query. Y axis will be Values in thousand.
    Currently no issues with Y-axis. But I am not able to figure out how I can have multiple category axis on X axis.
    Basically what I need is a way of creating 1 category which has 5 KFs.
    thanks,
    Murtuza.

    Thank you all for helping.
    Below  is how I resolved :-
    I created a structure of table (Key Figures) in Column of query designer and then use that structure in VC to output table.
    There I had used formula for each KeyFigures using IF ...something like this:-
    NVAL(IF(@Key_Figures=="Prior Sales",0,IF(@Key_Figures=="Price",NVAL(IF(#ID[ACA257]@Price_Impact_value>=0,#ID[ACA257]@Prior_Sales_Value,#ID[ACA257]@Prior_Sales_Value+#ID[ACA257]@Price_Impact_value)),IF(@Key_Figures=="FX",#ID[ACA257]@GAP_3,IF(@Key_Figures=="Volume",#ID[ACA257]@GAP_4,IF(@Key_Figures=="Lost Mix",#ID[ACA257]@GAP_5_6,IF(@Key_Figures=="Gain Mix",#ID[ACA257]@GAP_5_6,IF(@Key_Figures=="Current Sales",0,123))))))))
    This way I got the output table as required.
    Thanks,
    Murtuza.

  • Phone keeps on telling me network out of order

    Help! Everytime I try to send sms on my z10 it keeps on telling me network out of order. This is the first time that it has happened to me and it's really bothering me. How can I fix this?

    That seems strange.  Try registering your phone on the network once again.  
    To do this, swipe down from the top of your homescreen and select Settings>About and switch the Category menu to Network.  Next, press the three dots in the bottom right corner and register your phone again.
    Try that and post back with your results.  
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • Web Application Designer: Diagonal Category Axis dosn't work anymore

    Hi, I try to find out why I can't create diagonal category axis text. The settings down, up, default, right and below works fine but diagonal up or diagonal down doesn't work. Please help me to fix the issue.
    WAD v3.5

    Yes it is:
    for 6.40 based system:
    https://websmp202.sap-ag.de/~form/handler?_APP=00200682500000001043&_EVENT=INFO&INFONR=012002523100004619852007
    for 7.00 based system
    https://websmp202.sap-ag.de/~form/handler?_APP=00200682500000001043&_EVENT=INFO&INFONR=012002523100007664562007
    regards,
    kai

  • Align labels of the category axis (Y)

    Hi. How can I align labels of the category axis (Y) to the left?
    I suppose, it is aligned to the right, take a look on the picture. Thank you

    Badunit,
    The only way I have found to get the labels to wrap at all is to create the chart in Pages and insert Line Breaks into the Chart Table Label field. I'd be surprised if that Chart began its life in Numbers and I have to idea how to change the justification of the labels. The justification controls are grayed out in Pages when editing the chart data.
    Your suggestion of making labels in a table or text box is the only practical solution I can imagine.
    Jerry

  • Data written to socket getting lost?  or perhaps out of order?

    I'm trying to fix a bug in Flashmog. The bug is described in more detail here.
    Basically what is happening is that my Flash client claims that it is calling functions that don't arrive at the server -- or they arrive, but the socket data is out of order and therefore is garbled.  I've stared at the source code for hours and tried a lot of trial-and-error type stuff and added trace statements to see if I can find the problem and I'm not having any luck.
    In particular, there's class I have called RPCSocket that extends the AS3 Socket class so I can serialize data structures before sending them across a socket.  At one point, this RPCSocket class calls super.writeBytes and super.Flush.  It is the point at which I send all data out of my client. The data is binary data in AMF3 format.
              public function executeRPC(serviceName:String, methodName:String, methodParams:Array):void {
                   if (!this.connected) {
                        log.write('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected', Log.HIGH);
                        throw new Error('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected.');
                        return;
                   var rpc:Array = new Array();
                   rpc[0] = serviceName;
                   rpc[1] = methodName;
                   rpc[2] = methodParams;
                   var serializedRPC:ByteArray = serialize(rpc);
                   if (!serializedRPC) {
                        log.write('RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName, Log.HIGH);
                        dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, 'RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName));
                   super.writeUnsignedInt(serializedRPC.length);
                   super.writeBytes(serializedRPC);
                   super.flush();
              } // executeRPC
    Can someone recommend a way for me to store without corruption, conversion, or filtering or translation of any kind *all* of the information sent across this socket? I'd like to write it to a file.  I'm guessing that keep a global ByteArray var and storing the info there might work, but I'm wondering how I might get the contents of that ByteArray into a file so I can inspect it.
    Also, I'm wondering if I might be able to inspect what flash actually sends out on the socket?  I have a sneaking suspicion that data I supply to super.writeBytes may be sent out of order or may not actually get sent across the socket.  This bug I'm talking about only seems to happen under high-stress situations when I'm sending dozens of messages per second across this one socket.

    oops...forgot link to bug description: http://flashmog.net/community/viewtopic.php?f=5&t=549

  • Photos syncing from folder to iPhone all out of order?

    I have 2 folders synced to my iPhone 4 photo app.
    They were previous camera rolls before I set up my phone as a new device. They are all named in order and taken in order, for example IMG_001.jpg was my first picture in my old camera roll. IMG_822.jpg was the last photo taken before I did the backup, and is the last in the folder.
    The folder I am syncing from on my windows computer displays all of the pictures by filename (and because of that, by date) but when syncing with iTunes they end up on the phone ALL out of order. I can't find any rhyme or reason to how they are displaying. Most of the earlier photos show up at the beginning like they should, and the last at the bottom of the scroll appear to be mostly right, but then it's completely random from there.
    I've tried unsyncing them, removing them, and then adding them back again and nothing seems to work. I've even tried renaming the IMG_xxx numbers to different things and they still appear to sync in the same random order.
    Am I doing something wrong, or is this a huge bug for someone with OCD like me? lol

    This is highly annoying.
    I have probably 15-20 Smart Albums in iPhoto 8.1.2 in OS10.6.4 that are syncing to iOS4.0
    On the old software, my Smart Albums for photos would show up AS the smart albums I created. Now they show up in the iPhone one giant mess called "Photo Library".
    I can view photos broken up under "Events" on the iPhone by specific dates, but the dates don't tell me what the name of the event was, and some Smart Albums had multiple dates grouped together in one Smart Album and I don't really want them broken out separately by date. I want them organized how I organized them...
    In short, I want my photos grouped the way I have explicitly grouped them. It used to work, it doesn't now.
    Since iOS4.0 I am also getting sync errors all the time in iTunes. "iPhone cannot be synced because the required file cannot be found." WHICH FILE??? tell me and I will delete it...
    I've rebuilt the entire database in iPhoto (took 4 hours). I've scanned iTunes and removed all broken links and duplicate files. I've scanned the hard drive with the disk tool. I've emptied the iPhone and reinstalled iOS4 on it 5 times. I've turned syncing off for all non-essential applications and stuff I don't actually sync like voice memos. Same problem.
    I think I want my iOS 3 back. I don't really like multitasking anyway, always having to turn off applications for the one or two times in a million where task switching if helpful...
    Ugh....

  • The music I sync into my iPod touch is all literally out of order and in the library it's not. Why is this?

    I checked the starting time for songs in the library and on my iPod and they all say 0:00. What I mean when I say it's out of order is for example, the first ten seconds are skipped and placed somewhere in the middle of the song and some other parts are skipped then played later. I didn't have this problem before I updated iTunes for my new iPod, now when I tried syncing onto my old iPod as well, the same thing happens. So there's nothing wrong with my iPod. I want to know how I can fix this on iTunes or if it's just a glitch on my iTunes?

    Something you can try is resetting it all Settings > General > Reset > Reset all settings. Or go to Settings > Store &amp; sign out &amp; log back in. Another thing you can do is restore your ipod. This has happened to me but the only thing i did was that i created a new account but try doing the things above i just told you. :)

  • Video and audio not sync when i play all forms of video. from music videos, to tv shows. but they play perfect on my iPod. and tv shows display out of order on iPod, but in correct order on iTunes/computer. I even ran a virus check just to make sure.

    audio and video do not syncronize.  all forms of videos. music videos to tv shows.  what do i need to do the syncronize them again
    they are in sync on iPod, but not on computer.
    another issue that might be from the same cause is, the order of episodes of the tv shows i have downloaded,   they appear in order on computer, but on iPod they show out of order.
    any tips on how to fix this would very much help.
    thank you.

    Welcome to Apple Discussions!
    An old version of iTunes will cause this and mess up the videos on your iPod. Always make sure you always use an up-to-date version of iTunes.
    Make sure all the software on your computer is up to date...
    iTunes
    iPod Updater
    Updating iPod's Software
    You will then need to restore the iPod and then let iTunes update your iPod and put your music, videos, etc. back onto your iPod...
    Restore the iPod
    btabz

Maybe you are looking for

  • HD6850 Cyclone OC high GPU use on idle, low FPS and stutter in games

    Hello, Sometime in November I got myself a new graphics card, an MSI 6850 (this one).  Beforehand I'd been using an HD4770 for several years with no problems at all. It ran pretty perfectly for about a month and then I started getting graphics issues

  • BlackBerry Web Developmen​t on 64-bit Windows 7

    Hi , I am doing this project on Blackberry and right now I have 64-bit Windows 7 OS. So can anyone tell me the procedure to install the Blackberry storm 9500 simulator on my machine. Is it compatible with my machine configuration ? Are there any othe

  • Unable to read data from AQ

    Hi I am new to BAM and struggling with getting data out of JMS queue into BAM reports. Followed the steps as mentioned here The EMS has started successfully, there are messages that are enqueued in the AQ (as a result of inserts into the table) but t

  • Picture book different than iPhoto?

    Hi, I am a recent uupgrader from iPhoto to Aperature. I have been making books for years using the template "Picture Books" from iphoto. I can find the "Picture Book" selection in Aperature but it is not the same template that is in iPhoto where I ca

  • I don't know where else to post this. iTunes Remote Application

    I know they have the application "Remote" so you can control iTunes from your iPod Touch or iPhone, but is there an application that you can control your iPod Touch or iPhone from your iTunes? I see this useful because right now my computer is a lapt