LineChart XY, how to remove?

Hi all

I have a series of simple trace on a XY chart as below
public class SimpleXYLineChart extends Application {
 
@Override
public void start(Stage stage) {        
   stage.setTitle("Line plot");       
 
   final CategoryAxis xAxis = new CategoryAxis();
   final NumberAxis yAxis = new NumberAxis(1, 22, 0.5);
 
   yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis){
        @Override
    public String toString(Number object){
        return String.format("%7.2f", object);
    }
});
    final LineChart<String, Number>lineChart = new LineChart<String, Number>(xAxis, yAxis);
 
    lineChart.setCreateSymbols(false);
    lineChart.setAlternativeRowFillVisible(false);
    lineChart.setLegendVisible(false);
    lineChart.setTitle("LineChart");
 
    XYChart.Series series1 = new XYChart.Series();
 
    series1.getData().add(new XYChart.Data("Jan", 1));
    series1.getData().add(new XYChart.Data("Feb", 1.5));
    series1.getData().add(new XYChart.Data("Mar", 2));
    series1.getData().add(new XYChart.Data("Apr", 2.5));
    series1.getData().add(new XYChart.Data("May", 3));
    series1.getData().add(new XYChart.Data("Jun", 4));
    series1.getData().add(new XYChart.Data("Jul", 6));
    series1.getData().add(new XYChart.Data("Aug", 9));
    series1.getData().add(new XYChart.Data("Sep", 12));
    series1.getData().add(new XYChart.Data("Oct", 15));
    series1.getData().add(new XYChart.Data("Nov", 20));
    series1.getData().add(new XYChart.Data("Dec", 22));
 
    lineChart.getData().addAll(series1);        
 
    Scene scene = new Scene(new Group(), 800, 600);
    final VBox vbox = new VBox();
    final HBox hbox = new HBox();
 
    final Button remove = new Button("Remove Series");
    remove.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent e) {
    if (!lineChart.getData().isEmpty()) 
        System.out.println("Remove Series");
        lineChart.getData().remove(/*(lineChart.getData().size()-1)*/0);
        }
    });                
 
    hbox.setSpacing(10);
    hbox.getChildren().addAll(remove);
 
    vbox.getChildren().addAll(lineChart, hbox);
    hbox.setPadding(new Insets(10, 10, 10, 50));
 
    ((Group)scene.getRoot()).getChildren().add(vbox);
    stage.setScene(scene);
    stage.show();
}
 
public static void main(String[] args) {
    launch(args);
}   
}
I would like to delete the line drawn by clicking on the "delete" button and have the empty stage.

I found this example of scatterplot

docs.Oracle.com/JavaFX/2/Charts/ScatterChartSample.java.html

and it works, I don't know why my example does not remove traced, while the point cloud doesn't work, when I click on the button Delete I NullPointerException

Any help really appreciated

Hello. Please remove the following line. Then you can update your chart.

  lineChart.setCreateSymbols(false);

This is a bug. Please take a look at http://javafx-jira.kenai.com/browse/RT-22124

Published by: shakir.gusaroff on August 24, 2012 08:18

Published by: shakir.gusaroff on August 24, 2012 08:31

Tags: Java

Similar Questions

  • How to remove ARDAgent.app error in osx 10.11.4

    How to remove ARDAgent.app error in osx 10.11.4?

    Hello

    You can ignore these messages. You can also usually ignore any message "ACL found but should not...» ». These messages can occur if you change the permissions on a file or a directory; they are accurate, but is generally not a cause for concern.

    Mac OS x: Messages to repair disk from disk utility permissions that you can safely ignore

  • RE: iOS iPhone 6 s 10 how l remove or disable the slippery camera from outside the locked screen? This feature is a security and threat privacy for me.

    RE: iOS iPhone 6 s 10 how l remove or disable the slippery camera from outside the locked screen? This feature is a security and threat privacy for me.

    You can not. However, I'm not sure why you think it's a privacy or security threat. The only thing that can be accessed without unlocking the phone is the camera to take pictures. No one can access your data already on the phone.

    You can send feedback to Apple here:

    http://www.Apple.com/feedback

  • How to remove souvenirs tab pictures 10 iOS app?

    How to remove the tab from the Photos app in iOS 10 memories, because with memories tab, it's a big mess in my Photos app. I can't use my Photos normally because of this tab. I like facial recognition, but I don't want memories tab in my Photos app. I have movies app for that. A way to remove the memories tab? Thank you.

    Flanua wrote:

    A way to remove the memories tab? Thank you.

    N °

    Submit your Apple asking this feature here:

    http://www.Apple.com/feedback

  • How to remove pop-up virus?

    Does anyone know how to remove pop-up virus? Congratulations google user reviews, it then asks me to answer 3 questions to be in the draw to win an iphone7. Please help, it keeps popping up every time I have using the site "Kissasian".

    Have you tried resetting the network settings? You can do this by going to the settings, choose general and tap reset network settings. Then connect to the Wi - Fi connection again.

  • How to remove 1 reminder reminder EL Cap app?

    Hello

    How to remove 1 reminder reminder EL Cap app?

    I don't see any way the info button to the right is nothing...

    Try control - click/Delete.

  • I deleted my iphone iCloud, but there is some data in the storage, how to remove?

    I deleted the account from my iPhone iCloud because I switch to Android.

    But there are still a few left data on iCloud account. How to remove this account and how do I deactivate my account?

    See if that helps - manage your iCloud - Apple Support storage space

  • Batch how to remove all the photos that I deleted the photo library

    After a few months of use of the Photos App and deleting photos, I would like to know how to remove the hard disk all the pictures I deleted so far. (recently deleted folder is empty).

    Thanks for any suggestions.

    If your photo library is migrated from iPHoto then you will need to remove them in iPhoto too - or if you are sure you are finished with the iPHoto library archive yoru iPHoto and delete and empty the trash

    LN

  • How to remove Code condition on iwatch after the last update

    How to remove Code condition on iWatch after the last update?

    Hello

    On your iPhone, in the application of the watch, go to: My Watch (tab) > password - tap on disable password.

  • How to remove places the iphone with IOS 10 album

    HOW TO REMOVE PLACES AND PEOPLETOP ALBUMS SINCE IPHONE RUNNING IOS 10?

    lwwfromohio wrote:

    HOW TO REMOVE PLACES AND PEOPLETOP ALBUMS SINCE IPHONE RUNNING IOS 10?

    First, turn off your hats of all the...

    You can not as these files came with ios 10.

    don't like it use the contact us link below to notify Apple.

  • How to remove a network of comments?

    How to remove a comment WiFi network you created, or even edit to change the name and the password?

    Using AirPort Utility, as follows:

    • Your iMac, running the AirPort Utility.
    • Select your AirPort base station and then, select change.
    • Select the wireless tab.
    • To disable the Guest network, uncheck the 'Enable the Network'.
    • If you want to continue using this network, you can change the network name and password on this same tab.
  • How to remove lock to activate my iPhone?

    I'm lost password and account security question iCloud, but I have another apple id account connected to the iphone

    How to remove the lock of activation by another apple or connected accounts?

    You must remove the lock of activation with the same Apple ID, where it has been implemented, try to reset the password for the previous Apple ID If you forgot your Apple ID - Apple Support password

  • How to remove photos from my iphone6s after their importation?

    How to remove photos from my iphone6s after their importation?

    Hello KConstant,

    I understand that you're looking to remove photos from your iPhone, after you import the to your Mac. It depends largely on how the images are imported into your Mac.

    If you use iCloud photo library, remove photos from your iPhone, after they have synched to the Photos on your Mac afterwards would remove these photos on your Mac as well, like iCloud photo library is designed to synchronize your iPhone with iCloud and Mac.

    However, if you are importing photos via the USB port of the Photos app, you should be prompted to delete pictures from your device once the import is complete:

    Once the import is complete, a message asks if you want to delete or keep the photos on your device. Click on remove items to remove photos or click on keep items to keep them on the device.

    Import photos and videos from your iPhone, iPad or iPod touch
    https://support.Apple.com/en-us/HT201302

    You can also (it not allowed you iCloud photo library on your iPhone), you can use the image capture on your Mac app to delete images from your iPhone. This can also be useful to remove the last images that have already been imported into the Photos on your Mac. Once you have selected the images you want in the Image Capture, you can click on the prohibitive red symbol () to delete the selected items.

    Image capture: transfer images and other elements of your device
    https://support.Apple.com/kb/PH17894

    Concerning

  • How to remove a device lost from iTunes?

    We lost an android phone on my iTunes account.  He counts against our limit.  How do remove us it?

    Use the iTunes menu to navigate to account > view my account.

    Click on "Manage devices" under "iTunes in the Cloud."

  • How to remove icloud?

    I forgot my now impossible apple DLI use my phone.how to remove icloud... pls help me

    IMEI-*.

    < personal information under the direction of the host >

    Go to http://appleid.apple.com and click on "find your Apple ID" to find out what is your Apple ID. You will then need to go to http://iforgot.apple.com to reset the password.

    If you can not do this, your only other option is, assuming you bought the phone new and unused, to pick up the phone and the original purchase documents for a physical Apple Store and ask them for help.

Maybe you are looking for

  • T88 Partition on Satellite M70?

    Hello On my "new" and the first laptop from Toshiba is a Partition with large T88 and 204 MB file system. For what is necessary this partition? Thank youLima

  • integration of vi and teststand DAQmx

    So far I did well on teststand using instruments ordinary like scope, power, electric, generator functions, dmm and switches. So I had to use a map of daqmx for a particular test. And I found that I can't pass the reference to the task through testst

  • videos and flash running slow

    I never had this problem before, I do not download new programs, but from the latter, any video really taxes my computers processer and accuses my computer, not youtube, DVD, videos uploaded, streaming video, animated flash videos, all seem to have t

  • ProBook 4530 s: grinding noise near the vents when I turn on the laptop.

    Sometimes when I turn on the laptop, a loud grinding noise is heard from the left corner, near the vents.  I think that's probably the fan.  I turn off the laptop because it doesn't seem like grinding stops.  Then when I turn it on again, grinding no

  • Event ID 4625 (an error occurred during logon) keyword verification failure

    Event Viewer responds with this error, Source Microsoft security audit - it seems that there is a failure of the audit when there is a connection to the user account. I can't diagnose what caused a failure of the Audit, could you please help me? (I c