Update charts into FlowPane

I want to store Linecharts into FlowPane which I want to update using Service. I created this example:
public class MainApp extends Application
    @Override
    public void start(Stage stage) throws Exception
        Scene scene = new Scene(panels());
        stage.setTitle("JavaFX and Maven");
        stage.setScene(scene);
        stage.show();
    public static void main(String[] args)
        launch(args);
    private FlowPane flow = new FlowPane();
    private BorderPane bp;
     * @return
    private ScrollPane panels()
        flow.setPadding(new Insets(50, 5, 5, 5));
        flow.setStyle("-fx-background-color: white;");
        flow.setVgap(15);
        flow.setHgap(15);
        flow.setAlignment(Pos.CENTER);
        ScrollPane scroll = new ScrollPane();
        scroll.setStyle("-fx-background-color: transparent; -fx-background-insets:0; -fx-border-width:0; -fx-border-insets:0;");
        Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
        scroll.setPrefSize(primaryScreenBounds.getWidth(), primaryScreenBounds.getHeight());
        scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);    // Horizontal scroll bar
        scroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);    // Vertical scroll bar
        scroll.setContent(flow);
        scroll.viewportBoundsProperty().addListener(new ChangeListener<Bounds>()
            @Override
            public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds)
                flow.setPrefWidth(bounds.getWidth());
                flow.setPrefHeight(bounds.getHeight());
        initTest();
        addMonitoringService();
        return scroll;
    private BorderPane generatePanel()
        // BorderPane
        HBox thb = new HBox();
        thb.setPadding(new Insets(8, 10, 8, 10));
        thb.setStyle("-fx-background-color: linear-gradient(to bottom, #E9E9E9, #f2f2f2);");
        Text title = new Text("Test");
        title.setFont(Font.font("Verdana", 13));
        title.setFill(Color.BLACK);
        thb.getChildren().add(title);
        HBox bhb = new HBox();
        bhb.setPadding(new Insets(10, 10, 10, 10));
        bhb.setStyle("-fx-background-color: #B0B0B0;");
        DropShadow ds = new DropShadow();
        ds.setOffsetY(1.0);
        ds.setOffsetX(1.0);
        ds.setColor(Color.GRAY);
        BorderPane bp = new BorderPane();
        bp.setEffect(ds);
        bp.setCache(true);
        bp.setPrefSize(320, 180);
        bp.setMaxSize(320, 180);
        bp.setStyle("-fx-background-color: linear-gradient(to bottom, #FAFAFA, #EAEAEA);"
            + " -fx-border-width: 2px; -fx-border-style: solid; -fx-border-color: white;");
        bp.setTop(thb);
        LivePerformanceChart zz = new LivePerformanceChart();
        bp.setCenter(zz.init("Test"));
        VBox vbox = new VBox(bp);
        vbox.setPadding(new Insets(10, 10, 10, 10));
        return bp;
    public void addMonitoringService()
        flow.getChildren().add(generatePanel());
        for (int i = 0; i < 4; i++)
            flow.getChildren().add(generatePanel());
    public void initTest()
        service.setDelay(new Duration(300));
        service.setPeriod(new Duration(1000));
        service.setOnSucceeded(new EventHandler<WorkerStateEvent>()
            @Override
            public void handle(final WorkerStateEvent workerStateEvent)
        service.setOnFailed(new EventHandler<WorkerStateEvent>()
            @Override
            public void handle(WorkerStateEvent t)
        service.start();
    private final DataService service = new DataService();
    class DataService extends ScheduledService<Void>
        @Override
        protected Task<Void> createTask()
            return new Task<Void>()
                @Override
                protected Void call() throws Exception
                    for (int i = 0; i < flow.getChildren().size(); i++)
                        if (flow.getChildren().get(i) instanceof LivePerformanceChart)
                            LivePerformanceChart obj = (LivePerformanceChart) flow.getChildren().get(i);
                            obj.insertData(111);
                    return null;
LineChart
public class LivePerformanceChart extends Node
    private BorderPane bp;
    public LivePerformanceChart()
    private static final int MAX_DATA_POINTS = 50;
    private Series series;
    private int xSeriesData = 0;
    private final ConcurrentLinkedQueue<Number> dataQ = new ConcurrentLinkedQueue<>();
    private NumberAxis xAxis;
    private String type = "line";
    public String getType()
        return type;
    public void setType(String type)
        this.type = type;
     * @param name
     * @return
    public AreaChart<Number, Number> init(String name)
        xAxis = new NumberAxis(0, MAX_DATA_POINTS, MAX_DATA_POINTS / 10);
        xAxis.setForceZeroInRange(false);
        xAxis.setAutoRanging(false);
        xAxis.setTickLabelsVisible(false);
        xAxis.setTickMarkVisible(false);
        xAxis.setMinorTickVisible(false);
        NumberAxis yAxis = new NumberAxis();
        yAxis.setAutoRanging(true);
        // Chart
        final AreaChart<Number, Number> sc = new AreaChart<>(xAxis, yAxis);
        sc.setAnimated(false);
        sc.setId("liveAreaChart");
        sc.setTitle(name);
        // Chart Series
        series = new AreaChart.Series<>();
        series.setName(name);
        sc.getData().add(series);
        // Prepare Timeline
        prepareTimeline();
        return sc;
     * Update chart values
     * @param value
    public void insertData(int value)
        dataQ.add(value);
    // Timeline gets called in the JavaFX Main thread
    private void prepareTimeline()
        // Every frame to take any data from queue and add to chart
        new AnimationTimer()
            @Override
            public void handle(long now)
                addDataToSeries();
        }.start();
    private void addDataToSeries()
        for (int i = 0; i < 20; i++)
        { // Add 20 numbers to the plot+
            if (dataQ.isEmpty())
                break;
            series.getData().add(new AreaChart.Data(xSeriesData++, dataQ.remove()));
        // remove points to keep us at no more than MAX_DATA_POINTS
        if (series.getData().size() > MAX_DATA_POINTS)
            series.getData().remove(0, series.getData().size() - MAX_DATA_POINTS);
        // update
        xAxis.setLowerBound(xSeriesData - MAX_DATA_POINTS);
        xAxis.setUpperBound(xSeriesData - 1);
    @Override
    protected NGNode impl_createPeer()
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    @Override
    public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx)
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    @Override
    protected boolean impl_computeContains(double localX, double localY)
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    @Override
    public Object impl_processMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx)
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
So basically I want to insert all charts into the FlowPane and then every second to us the Service to update the charts by calling the method insertData
but nothing happens. I tried to extend the custom class with Node in order to insert it into FlowPane nut the chart is empty.
Can you help me to fix this example?

Any help is highly appreciated. I need to solve this problem.

Similar Messages

  • Pasting chart into pages from numbers

    How come I can't copy/paste charts into pages from numbers anymore?  I used to be able to on the last edition now with the new update when I go to paste the chart nothing happens.

    If you are using Pages v5 (any version), then you need to be using Numbers 3+ for copy/paste. If you are using Pages ’09 v4.3, you need to be using Numbers v2.3. Mixing versions breaks things.

  • Moving Numbers Charts into Word

    I am having trouble exporting charts I make in Numbers to Word (which I need to use for my dissertation). Right now, every time I do this Word (2004) imports the chart as a picture with a black background (making it virtually impossible to read).
    My question is whether there is an easy solution to this problem.
    I have seen one post in this forum that suggests Apple has a work around. It says that Apple has "solved" this transparency problem. But I see no mention of how or how to apply it. All of my software is updated.
    I have also seen the post that describes the long work around (export to a third application like photoshop and then import into word), but I don't consider that a real solution.
    Any ideas?

    My workaround solution to get Numbers charts into Word 2004 and 2008 is to place the subject chart(s) onto one or more sheets - I tend to put each chart on a separate sheet - then export the charts as PDF files, set for "Best Quality" and to the "Current Sheet". I then generally drag each individual PDF into Word and adjust as necessary for scale and position.
    I'll admit that IMO Word 2004's graphics engine really wasn't (Isn't?) consistent or that great at handling non-native graphics, and I've encountered the black picture syndrome dozens of times, and just try reimporting until I get what I want. I've also used Apple's Preview application (via Automator) to generate TIFF and JPG files of the PDFs I generate, and almost all of the time one of the resulting files gets me what I need.
    One last method of shoehorning an image into either Word application that's worked wonders for me since Word 2001 is to choose the graphics element you want to get into Word and copy-paste it into Word, letting the Clipboard handle the translation; I've used this technique just this morning to get two graphs (a copied one-page PDF from Preview and a small chart from Numbers) into Word as graphics, albeit into Word 2008 - the finished product was exactly as I'd expected.
    One last option is to copy your elements, one at a time, to the Clipboard, and to use the Word "Paste Special" command, choosing the "as Picture" option; the pasted elements likely will look a little fuzzy, but they're in your document.
    Good luck - I hope my offering helps, and if a more direct method were available, I'd love to know what the better solution is!

  • Background job finishes but error Error While Updating Material into Standard SAP5678

    Dear
    we run background job which finishes successfully but when we sqw logs it shows
    Error While Updating Material into Standard SAP5678
    Kindly share the reasons
    Regards

    This is an ERP Upgrade space and you should consider raising threads in the right space for prompt replies. Next time consider using SAP NetWeaver Administrator space for issues like these. Also you should consider closing your previous thread with the correct answer for future reference.
    What I see is a custom job. You should check what the job does and also the trace file of the work process and the consult with the application team or the developer for more information. Unfortunately with that screenshot there is nothing much we can advice you.
    Regards
    RB

  • How to get new and updated data into LO Excel in Xcelsius

    Dear Experts,
    I have created dashboard on top of webi report by using Live-Office connection. Latest data of webi report is imported into excel and mapped data with components and generated SWF file and exported into server.
    To day my webi report has latest instance with new and updated data. But until unless by clicking "Refresh All Objects" i am not getting updated data into excel.
    When i am trying to open dashboard in BI Launch Pad/CMC it is showing data whatever exist in excel(i.e yesterday data). But here we need to show data of latest instance of webi report.(i.e New and updated data as of now).
    I have selected option "Latest instance: From latest instance scheduled by" in "refresh options".
    My Question & Doubts:
    1) Is it mandatory to open dashboard every day and need to click on "Refresh All Objects" to get updated data into excel or dashboard.
    2) Is there any option to automate this process.
    Regards,
    PRK.

    Hi,
    Schedule the webi report to get the latest data from the source. To answer your query no is doesn't require to open the dashboard every time to refresh the excel to get the latest data.
    Please use the Refresh Before Components are Loaded: Select this option to refresh the data each time the model loads and to use that data as the initial data for the model (using a Reset Button component, it will reset the data to the values from the last time the model was loaded).
    You are using the Live Office  so here automatic refresh is not possible without touch the swf file, you need to use the refresh but to get the latest data. If you are using QAAWS, Web Service & XML then automatic refresh is possible.
    For more information please check the below document for in-depth idea on the design pattern.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b02e31fb-3568-2e10-e78f-92412c3c0a96?overridelayout=t…
    Kindly revert for more clarification!!!
    --SumanT

  • HT201328 Hi. i bought an iphone 4 from china in a local store, before its software version was 4.3.5 now i updated it into ios 6 but my phone in locked now... so how can i unlock this phone? someone told me its a locked phone from at&t.

    Hi. i bought an iphone 4 from china in a local store, before its software version was 4.3.5 now i updated it into ios 6 but my phone in locked now... so how can i unlock this phone? someone told me its a locked phone from at&t.

    Only the carrier can unlock your iPhone.

  • How to updated matrix into related table?

    hi, can anyone help me below coding how to updated matrix into related table?
    Thank you.
                For rowNum = 0 To oMatrix.RowCount
                    oRecordset.Fields.Item("Code").Value = oMatrix.Columns.Item("DSCode").Cells.Item(rowNum).Specific.Value
                    oRecordset.Fields.Item("Name").Value = oMatrix.Columns.Item("DSName").Cells.Item(rowNum).Specific.Value
                    oRecordset.Fields.Item("U_RPTC").Value = oMatrix.Columns.Item("DSReport").Cells.Item(rowNum).Specific.Value
                    oRecordset.Fields.Item("U_USRC").Value = oMatrix.Columns.Item("DSUser").Cells.Item(rowNum).Specific.Value
                    oRecordset.MoveNext()
                Next

    For Fast Matrix Loading you can user some thing like this.
            Dim Column As SAPbouiCOM.Column
            Dim Matrix As SAPbouiCOM.Matrix
            Dim Table As SAPbouiCOM.DataTable
            Table = oForm.DataSources.DataTables.Add("Documents")
            Table.Columns.Add("Code", SAPbouiCOM.BoFieldsType.ft_Integer)
            Table.Columns.Add("Name", SAPbouiCOM.BoFieldsType.ft_Integer)
            Table.Columns.Add("U_RPTC", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric, 255)
            Table.Columns.Add("U_USRC", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric, 255)
            Matrix = oForm.Items.Item("MatrixUID").Specific
            Column = Matrix.Columns.Item("Code")
            Column.DataBind.Bind("Documents", "Code")
            Column = Matrix.Columns.Item("Name")
            Column.DataBind.Bind("Documents", "Name")
            Column = Matrix.Columns.Item("U_RPTC")
            Column.DataBind.Bind("Documents", "U_RPTC")
            Column = Matrix.Columns.Item("U_USRC")
            Column.DataBind.Bind("Documents", "U_USRC")
            Table.ExecuteQuery(SQLQuery)
            Matrix.LoadFromDataSource() 'Load The Data to the Matrix
    To pull the data form the display back to the Table you can use this
    Matrix.FlushToDataSource()

  • Moving a chart into an exact position

    Hello,
    I am working on acrobat and I want to place a chart into an exact position in the document, but when I grab the chart it is placed either too high or too low from the place I want to put it.... how can I fix that? how can I place the picture/chart in the place I want it without going to high are too low in the document??

    First of all, Acrobat is not a layout application and using it for that
    purpose is both tricky and dangerous, as it can totally screw up your
    document. If possible, stick to an application that more suited for this
    task, like InDesign.
    To answer your question: Make sure that the following option is NOT
    selected: View - Show/Hide - Rulers & Grids - Snap to Grid.

  • Excel chart into InDesign - resolution problem

    Hello, I am working on a Mac OS 10.8.3 and using InDesign CS6
    I have to place a chart that was created in Excel into InDesign and I realize there is a resolution problem if we start to print.
    Would you suggest I create the chart using an Adobe product? I am just trying to save time, but I'm afraid that may be the only answer.
    I have a screen shot below of kind of what it looks like. I have about 25 of these.
    Thank you.

    I tried pasting the chart from Word into Excel and then I dragged that chart into Illustrator and then copied into InDesign. Probably used an extra step there, but..
    I went to this site for help too; http://helpx.adobe.com/indesign/kb/import-excel-data-charts-graphs.html
    The text comes in a little funny, but I redid the text boxes and I was able to get in and edit some of the elements.
    Thank you!

  • How to paste excel chart into word

    how to paste excel chart into word?

    Assuming you are using Office for Mac, you might want to ask your question in the Office for Mac forums where the Office for Mac gurus hang out. http://answers.microsoft.com/en-us/mac?auth=1

  • How fix lost dialog box for typing in wanted web site url after installing security update 20110811165603 into Mac OS 10.6 snow leopard today 6.04.2011.

    Today, was prompted to install new security update. Did so. Now when click on + to open new tab the words New Tab appear in the tab. But, no dialog boxes appear to type in wanted new URL and no google dialog box appears in the tab area.
    Every thing was fine before installed this new security update 20110811165603 into Mac OS 10.6 snow leopard computer.

    Thanks for your reply and sorry for the delayed response - have been away for a few days over the holidays.
    I understand your point about backups and disk permissions. I do have a back up copy and will adopt using the 'verify disk' step in future; so, for me the loss shouldn't amount to any more than the time I have spent, as frustrating as that is. However, I think the point I'd like to make is that doing a disk permissions check is fine for those like me [or others on this forum] since I work in a hi-tech industry, and have worked in a Unix/Linux environment for the last ~20 years so understand about permissions etc. , but I know people with Macs for whom the key advantage is that the they largely 'manage themselves' seamlessly. So, if the verify step is simply a pushbutton check-then-repair step and omitting it can lead to such fatal errors, then why can't it be built into the update script as the first automatic step ? What I mean is; my computer reached this unusable state simply by pressing 'ok' on a planned update, so to the average-Joe user it looks like a 'stop and catch fire mode'.
    For info: I have now used Disk Warrior, which is reporting a disk malfunction, but can recover the user data. It seems to be a remarkable coincidence though, because there were no system problems exhibited before the update.

  • Regarding updating data into ztable

    hi all,
         When i am updating data into ztable .
    Old record is deleted and new record is created
    What will be the problem.
    Please suggest.
    Regards
    Rami

    Hi,
    pz use ur syntax this way.
    UPDATE zo9_user_status
                    SET  sub_date = sy-datum
                         sub_time = sy-uzeit
                         status = g_wa_outtab-status
           WHERE  representative = g_wa_outtab-representative AND
                           selection_id = g_wa_outtab-selection_id AND
                           sub_date = g_wa_outtab-sub_date AND
                           sub_time = g_wa_outtab-sub_time AND
                           superior = g_wa_outtab-superior.
            IF sy-subrc EQ 0.
              COMMIT WORK.
              l_error = 'X1'.
            ELSE.
              l_error = 'X2'.
              CLEAR l_error.
              ROLLBACK WORK.
            ENDIF.
    hope this helps.
    thanx.

  • What's the best way to incorporate a d3 chart into UI5 application?

    Hi folks,
    I'm on a project which requires to incorporate a d3.js based chart into a UI5 application.( sap.viz library doesn't fullfill )
    I'm thinking maybe to extend a sap.ui.core.Control.
    But here comes some problems:
    1. how to implement the renderer function?
    renderManager has the write() method, but this method is to write html strings. But I'll use d3's method to draw the svg elements.
    How can I do that?
    2. how to achieve responsive ?
    I'm not sure how to auto adjust my chart size to the actual device size.
    3. how to refresh my chart when data changes
    my chart will receive some data from outside. how to refresh my chart when data changes?
    Regards,
    Aaron.

    Hi Dennis,
    what I had in mind is:
    1. extend control ( I don't know if it's too much overhead )
    2. directly operate at the dom level ( there is this sap.ui.core.html class, I don't know if I can use this and how).
    But for both above solution. I don't know how to implement and its feasibility.
    So I'm asking if someone has done something like this before. Maybe some experiences can be shared.
    Regards,
    Aaron.

  • Is 10.8.2 Supplemental Update Incorporated into Mac App Store Download?

    I am considering upgrading my MBP (Late 2008) to Mountain Lion in a week or so and I was wonder if anybody knows if/when the download that is available within the Mac App Store has the 10.8.2 Supplemental Update incorporated into it or whether the offered build has been updated?

    Don't bother with the MAS. Just DL them manually. That way you can store them for future use:
    http://support.apple.com/kb/DL1581 and supplemental http://support.apple.com/kb/DL1600

  • HT4623 In my iphone currently there is ios 6.1.2 .. if i update it into 6.1.3 can i have to do repurchase or reinstall all the applications that are currently working on ios..?

    In my iphone currently there is ios 6.1.2 .. if i update it into 6.1.3 can i have to do repurchase or reinstall all the applications that are currently working on ios..?

    Perform the Update using iTunes on the computer you usually Sync and Backup to...
    See the Using iTunes Section Here...
    How to update your iPhone, iPad, or iPod touch

Maybe you are looking for