How to dynamically change the graphic style css?

What is the right method to dynamically replace the graphic style of JavaFx 2.2 in the code? I modified the example in the tutorial below with or without loading the css file. So far, I am unable to replace the style from the code. My goal is to dynamically set the width of each line. We use Java with Eclipse on Windows 7 (64-bit) 7_51. The CSS generated in the code below works when it is in the file. There must be a better way than to write a new file and read it, right?

      String title = "Chart Title";
      stage.setTitle("Stage Title");
      final LogAxis xAxis = new NumberAxis();
      final NumberAxis yAxis = new NumberAxis();
      final LineChart<Number, Number> chart = new LineChart<>(xAxis, yAxis);
      chart.setTitle(title);
      chart.setLegendVisible(false);
      chart.setCreateSymbols(false);
      xAxis.setLabel("x-axis");
      yAxis.setLabel("y-axis");

      // each bar is a line from x,0 to x,y
      int width = 24; // pixels
      for (int i = 0; i < ydata.length; i++)
      {
         String css = "";
         // TODO: dynamically calculate unique width for each "bar"
         final XYChart.Series data = new XYChart.Series();
         data.setName("Series" + (i + 1));
         data.getData().add(new XYChart.Data(xdata[i], 0.0f));
         data.getData().add(new XYChart.Data(xdata[i], ydata[i]));
         chart.getData().add(data);
         // Dynamically set style instead of reading from file
         // Assign each "bar" data series a color and line width
         css += ".chart-series-line{ -fx-stroke: red; -fx-stroke-width: ";
         css += width;
         css += "px; }\n";
         data.getNode().setStyle(css);
         System.out.println("node style: " + data.getNode().getStyle());
         System.out.println("node style class: " + data.getNode().getStyleClass());
         width *= 3; // TODO: replace this with dynamic calculation of width
      } // end for

      final Scene scene = new Scene(chart, 800, 600);
      scene.getStylesheets().add("Chart.css");
      System.out.println("Scene stylesheet: " + scene.getStylesheets());
      System.out.println("chart style: " + chart.getStyle());
      System.out.println("chart style class: " + chart.getStyleClass());
      System.out.println("chart style sheet: " + chart.getStylesheets());
      stage.setScene(scene);
      stage.show();

The Node #setStyle (String) method only supports the statements, not the rule full css. The setStyle call with '.chart-series-line {-fx-stroke...} '. "should give an error in the parser. Something like "whereas IDENT.

You might find the line you want in the series. If series.getNode () is a form (as it will be for a line chart), you can just get the node in a form and call the setStrokeWidth() directly.

Tags: Java

Similar Questions

  • How to dynamically change the host name in the Pages of the URL of the APEX

    Dear gurus,

    Please advise me on how to dynamically change the hostname in the URL used in the pages of the APEX.

    For example: I have the below URL in one of the apex pages.
    owa_util. REDIRECT_URL ("http://adminlxdb03.texas.org:7780/pls/htmldb ' |' / f?") p ='|| v ('APP_ID') | ": 151:" | " v ('APP_SESSION'));

    in the case of a Migration of this apex from one server to another (for example, TEST the PROD box), this / these pages are wrong because the different host id name in the PROD box.

    Is it possible that we can dynamically change the hostname in the URL used in the pages of the APEX.

    for example
    owa_util. REDIRECT_URL ("http://adminlxdb03.texas.org:7780/pls/htmldb ' |' / f?") p ='|| v ('APP_ID') | ": 151:" | " v ('APP_SESSION'));

    should become

    owa_util. REDIRECT_URL ("http://adminetuxdb09.texas.org:7780/pls/htmldb ' |' / f?") p ='|| v ('APP_ID') | ": 151:" | " v ('APP_SESSION'));

    It's adminlxdb03.texas.org (TEST) at adminetuxdb09.texas.org (PROD).

    If the page has no error...

    Please notify.

    Thank you
    Sheik

    You don't need to provide the hostname while redirecting in the pages of the apex

    owa_util. REDIRECT_URL ('f? p ='| v ('APP_ID') |) ": 151:" | " v ('APP_SESSION'));

    should work just fine.

  • Insert a table in a mail, how can I change the color/style of the border?

    Hello, I think my question is simple, that I just haven't found how to change the color and style of the borders of a table that I inserted in an e-mail.

    Thanks in advance for your help

    Do exactly as described by guigs2.

    This image will help... see below.

    As before open table properties. Make sure you select 'Table' and then click 'Advanced Edit' button

    In HTML tab attributes

    • Type "bordercolor" in the "attribute".
    • in value, you can use the word for example: blue or type a string for example HTML color: #3333ff
    • Click OK to close the advanced properties editor
    • Click 'Apply' to see color.
    • Click OK to close the properties of the table.

    If you don't know HTML color string, you can find some here.
    In a normal write the message, click on the text color icon to open a small window of text color. When you select the color, it will show you the html string of the color, which must be the hash tag # before letters them and numbers.

  • How to dynamically change the color of the text in the lookout?

    I wish that the color of the text to change according to a different value.  How can I do this at Lookout?

    I tried to find connections to text insertions and expressions but have failed.

    Thank you

    Dave

    Change the display text property, setting the Style of background as "Transparent".

    Create a gauge object. It is capable of changing color on different conditions. Put the gauge above the text display.

  • How to dynamically change the names of columns LOV

    Hello

    I use JDeveloper 11.1.1.4

    I have only one requirement, while I need to change the names of columns in the list of values dynamically.

    How can I achieve it.

    Please help me.

    Kind regards

    John.

    Hello

    > But I want to change the column names 'ID' and 'Name' dynamically.

    Based on what? Condition? If Yes, have you tried to set the text for the label as an expression? If not based on the condition, you can also expose the VO to Java Impl and need a way to get the attribute and change its label.

    Arun-

  • How to dynamically change the image depend on the input parameter

    Hi all

    I have a running report depend on the particular organization, I have 15 operating unit and 15 different logo for each operating unit.

    How to change the Logo depend dynamically on the entrance past the user.

    If I have three or four logo I can add to my disposal help if another statement and his works fine but I have more than 10 logos so it was not possible to keep these in my RTF model.

    Is it possible to change the logo according to the entry without keeping this model.

    I saw this link but its not very well

    http://erpschools.com/articles/display-and-change-images-dynamically-in-XML-Publisher

    Concerning
    Srikkanth.M

    Can u send me the files?

  • How to dynamically change the label of the TAB

    Hello

    I want to change the label of the TAB dynamically, based on: APP_USER.
    Suppose user1 connections... I want to set the LABEL of the TAB to Label1
    If... User2 connections... I want to set the LABEL of the TAB of Label2
    How can I do this...

    Thank you
    Deepak

    Deepak

    Here's a way to put the tabs dynamically

    Create an application called G_TAB_NAME
    Create an application process with a point in the process of 'New Session after authentication' and the code to set a value for G_TAB_NAME. Something like

    if :app_user='user1' then :g_tab_name='Label for user1';end if;
    if :app_user='user2' then :g_tab_name='Label for user2';end if;
    

    In the tab page definition set "Tab label" to & G_TAB_NAME.

    CITY

  • How to dynamically change the selection mode of the listbox control?

    Hello everyone

    Is it possible to change the selection mode of the ListBox dynamically?

    Both cases to the attached vi works the same way. I want the listbox to change the mode of selection by 1 point when the channel selected in the drop-down list box is SET.

    Can anyone help please?

    Thank you

    Simo

    There is a property for Listboxes node called selection Mode.

    Do not use the control Terminal in one case and a local variable of it in the other.  Moving the Terminal outside the structure of matter and son in the structure of the case.

  • How to dynamically change the APXWS_MAX_ROW_CNT?

    Hi all

    I am looking for a solution dynamically set the parameter APXWS_ROW_CNT (number of lines Maximum).

    That is when you call a report interactive by default must be on, for example, 10,000, due to performance.

    But when the user wants to get all the records, it should be able to change this value to null or 10,000,000 (i.e. show all).

    I tried the following:

    1. Do not set APXWS_ROW_CNT in the configuration of the report (paging = > number of lines Maximum) = > all folders should be displayed.
    2. Add a where clause to the view: select * from bird where rownum < =: P0_ROW_COUNT;
    3. Default - P0_ROW_COUNT to 10,000
    4. Change the value of 1,000,000 by click of a button

    APEX-view in-house for the default value of P0_ROW_COUNT looks like this

    Select * FROM)

    Select * from bird where rownum < = "10000"

    ) r

    This seems good.

    But when you define a filter in the IR, for example SS_NAME = "PP", the APEX-view interns as this looks:

    Select * FROM)

    Select * from bird where rownum < = "10000"

    ) r

    where ("SS_NAME" = "PP")

    The research comes not all records in the database, but only on the first 10000.

    And if there is no record in the 10000 first with SS_NAME = "PP" the result set is Null, even if there are hundreds of records in the database that meets the condition.

    If this isn't a solution.

    The APXWS_ROW_CNT parameter to 10000 I get the APEX-inside view

    Select *.

    DE)

    Select * from)

    Select * from bird

    ) r

    where ("SS_NAME" = "PP")

    ) r where rownum < = to_number('10000')

    = > Search on all of the base, the result is ok, but I don't have the possibility to get more than 10,000 records.

    Does anyone know a solution?

    Kirsten

    Hi all

    I found a solution not so nice, but it works.

    At the TOP, you can enter a number in the 'Maximum lines number' section of an interactive report. I don't know why it is implemented in this way because the max_row_count field in the wwv_flow_worksheets table is of type character.

    My idea is this:

    1. Add dynamic action "on the new session" with plsql

    Update APEX_040200.wwv_flow_worksheets set max_row_count = '& P0_ROWS' where flow_id = 111 (my app_id).

    2. Add a hidden field p0_rows page 0 with the default 10,000-online 10,000 lines will be shown

    3. Add a button or something to your application to change P0_ROWS to null (empty string) or 100,000,000 and update the interactive report

    -online all the lines of the report will be displayed (or 100,000,000).

    The only problem is that a "Maximum number of lines must be digital." error if you open the interactive report region because the value of the point "number of lines maximum.

    (tab Pagination) is now the string "& P0_ROWS.". Therefore, delete this value whenever you change something in this region.

    Kirsten

  • How to dynamically change the last part of the url inside the body HTML in e-mail send to Apex process

    Hello

    I need to change the last part of the URL sent by post in the apex dynamically. I have a requirement that a person can register itself with a new user name and other details. When the user clicks on the button register after you have entered all the required values in the page all values will be inserted into the user_details_repository table in the database. At the same time an email with a url link is sent to the user admin for the assertion. When the admin user, click on the link it is redirected to a page where all the details submitted by this particular user is displayed. The admin user can confirm or reject the new user registration. If the admin user says, all the data repository of this particular user table will be inserted in a main table named user_details and data will be deleted from the repository table. Yet once if the admin user rejects, all the data repository of this particular user table will be deleted.

    For this, I have created two pages for this and all of the features mentioned above works correctly except change the link url each time a letter is sent to the admin user when a new user register itself. To send email, I created send e-mail process. I need to change the last word/part of URLs within html body according to the username provided by the new user.

    for example, the url to another user will be like this:

    http://localhost: 8080/apex/f? p = 103:9:3849261906471:NO:USERNAME:Namrata

    http://localhost: 8080/apex/f? p = 103:9:3849261906471:NO:USERNAME:Madhura

    Help, please.

    If there is another way to achieve the same thing please answer.

    Thank you

    Nilesh

    Hi Nilesh,

    You can use a Page element as a substitution variable in the body of the HTML message.

    for example, blah blah blah & P123_MY_PAGE_ITEM. blah blah blah

    The syntax is an ampersand in front of the name of page element and a point after the name.

    brgds,

    Peter

  • How to dynamically change the generated query through the "query by example".

    Hi all. I'm relatively new to the ADF, so I've been beating my head against a wall trying to figure out how to do this... Any help would be greatly appreciated!

    What I try to do is to make a custom search (query) against a set of tables in the database. Normally, I would use just the ability to "filter" the af: table to do this (query by example). However, the query I need to run has three specific requirements:

    1. I need to change the 'WHERE' clause differently according to the field in which the user enters criteria in. For example:
    -If the user enters something in the field 'name' of filter, the default ADF BC will do is add '%' to the value entered, turning it into a query "begins by". I also want to prepend a '%' to the input value, (for example "doe %'), it becomes a query 'contains '. I don't want the user to see the '%', I put at the beginning of the field in the UI, however.
    -If the user enters a value of 9 digits in the field 'SSN', do a query of "accurate". If they penetrate only 4 digits, do a query "ends by". (I could always just a query "ends by" - for example "% of values" - even if they have put in 9 digits, and that would work.) However, an exact match will run faster because of the index on the field, so I want to use that if we put 9-digit.)

    2. I also need to change the SELECT part of the query based on which fields are used in the filter.

    3. If the user enters the filter values in several fields, I need 'OR' them together. The default functionality, it's that they are 'linked' together.

    Can someone point me in the right direction? My thought was somehow replace the manner in which the query is generated when the user presses ENTER to run the filter. But, I can't seem to understand where and how to connect it to this process to customize the SELECTION and WHERE the parts of the generated query. I'm sure that there is a way, and I hope more experienced ADF'ers can direct me to the solution.

    Thank you!

    Published by: 926392 on June 25, 2012 15:39

    Published by: 926392 on June 25, 2012 15:40

    Check this post in the ADF Code corner for the necessary information:
    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/30-table-filter-queries-169172.PDF

    Thank you
    Nini

  • How can I change the graphics in different areas of a movie?

    I have a project I have been working for a flooring company. They want a Flash animation that allows the user to change the appearance (color and product) of the different areas of the floor.

    I have a menu on the side left which refers to the three different areas of the floor. I have the two products as well as samples of color on top. I currently have each of the three areas as separate movies loading in a main movie.

    These films from three region each contain samples of color on top like buttons to change the color of this area using actions ' on release > go to image tag "that displays each of the different colors. These films each load on another plan, based on the selection in the left menu.

    I want the user to be able to go to each of the three areas and change the attributes of the product and/or the color without losing what they had already done. For example, if they choose the PRODUCT A in RED for ZONE 1, then they want to change the product and/or color on ZONE 2, I still want to film on view A PRODUCT in RED for ZONE 1, etc..

    The problem I encounter is that when you go back between the three areas, navigation controls that this film is the highest level and does not allow the user to return to a previous area and change the product and/or the color attribute.

    Keep in mind, I'm a designer, not a developer. My Actionscript knowledge is very superficial, to not throw a bunch of "geek talk" look at me ;-)

    We don't know how you have arranged design timeline-wise, but what you need to do is to get out the chronology by as much as using clips.  Each zone as a movieclip different that you control with the selection buttons.  In this way, change the current image of a movieclip does not interfere with another.

  • How to dynamically change the default period fast?

    Hello guys

    I have a situation... I currently have a dashboard the guest on a column called sales period. The requirement is to make the default value of this prompt to the current period.

    Data stored in this column are of type varchar that goes like 200903, and there are the values up to 201201. Currently, the calendar period is 200910, but the sales period should be 200903, in other words, there is still a difference of 7 months between the two, and the new date change period is always the 15th of each month...

    I think to create a dynamic variable to manage this requirement, but I do not know how and what type of logic to put in...

    Could someone give me some suggestions?

    Thank you very much

    Initlization block SQLs is actually a physical SQL with the same syntax as your database. The SQL is executed as it is on the database of the initiliztion block. Check if you are using the right connection of the inilization block pool.

  • How can I change the graphics on the front?

    Hello!

    My problem is the following:

    I need a front panel, where I can edit the chart. But there is no need to be very complicatted. That means, there are 5 steps. For example: it will control a heat room, and it should give 2 hours down to the room constant at 25 ° c for 2 hours, then cool until 2 hours at-40 degrees celsius, 4 hours on-40, then back to 01:35 hours, staying there for 2 hours, up to 105 degrees celsius up to 2 hours, 4 hours on 105, stand 2 hours. But I need to be to control levels. The levels of temperature and time periods. It is nessesery to struggle against this on the façade. I found a vi, which is the reading in files *.lvm datas x, y, then it is to interpolate. But this isn't customizable after setting.

    Please help me. Thank you very much!

    If you want to specify the profile graphically, you can use the sliders to make. A previous example can be found here. You can find others by doing your own research (hint, hint).

    Otherwise, you can simply use a multicolumn listbox to specify profile indvidual segments and a chart can be used to display the input profile whenever the list box changes.

  • How to dynamically change the value of a column in a report

    Hi, I'm new to APEX and I have a small requirement. I have a report in a page which I query. Report will always have only one record. I need to change a value of a column in this report of the value received from another page. I was able to send the value of another page on my page of reports to a hidden page element, but I don't know how I can configure this value received to this column in the report. Is this possible? If Yes, can anyone help with this?

    970829 wrote:

    Please update your forum profile with a real handle instead of '970829 '.

    Hi, I'm new to APEX and I have a small requirement. I have a report in a page which I query. Report will always have only one record. I need to change a value of a column in this report of the value received from another page. I was able to send the value of another page on my page of reports to a hidden page element, but I don't know how I can configure this value received to this column in the report. Is this possible? If Yes, can anyone help with this?

    Not really clear exactly what it is you are trying to reach. You want to replace the value of a column in the report with the value of a page element? If so, simply replace the column in the report with a reference to the required page elementquery:

    select
       empno
    , ename
    , job
    , :p2_sal sal -- Replace value of sal column with value of P2_SAL item
    from
       emp
    

Maybe you are looking for

  • y510p 8.1 Windows black screen

    I tried to update my y510p to windows 8.1 twice now. But once installation is complete I get a black screen with a cursor. I tried to start in safe mode to install the right drivers, but it won't let me. It automaticaly boots and restore the previous

  • How can I download the software to your vaio computer?

    I tried to download the latest vaio update software but I can't do it. A download apper error.

  • Where to find driver for AL1717

    Hello I need help to find a better driver for my Acer AL1717 monitor, currently using Windows XP SP 3 and centOS 6.

  • Pavilion M7640N + 2 TB HDD

    Hello I have a HP Pavilion M7640n (running Win7 32 bit) and a 2 TB Seagate drive in a motor housing (Mediasonic USB) I want to use with the PC as a HARD drive external for backup purposes. My problem is that the drive is not displayed when connected.

  • Network crashes at startup

    When I start my computer, the network in the taskbar icon hangs for about 2 minutes with the busy (spinning in arrow icon) or job action.  This causesinternet works to be locked up and do not work for 2 minutes. Convenience store can't probably becau