Calculation value of axis based on, click in the chart area.

Hey there, I'm still working on my graphic feature and so far I've been able to get help on these forums.

I need to be able to calculate the values of the corresponding axis in a click in the chart area. I see no real utility method in the NumberAxis class which will help me to do it. The only thing I can think is to get the bounds of the array and that relate to what I know about the range of the values I put in.

It is a line chart with two NumberAxis. I want to display on click, (x, y)-value as PR. the axis of the point clicked. Is it possible that I can do this easily, or I just need to design a work around?

Yes, it's a little tricky, but not too bad. It would be probably good for XYChart have public X getXValue (Point2D) and the public methods of getYValue (Point2D) Y. This works, however:

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

public class LineChartSample extends Application {

    @Override
    public void start(Stage stage) {
        stage.setTitle("Line Chart Sample");
        // defining the axes
        final NumberAxis xAxis = new NumberAxis();
        final NumberAxis yAxis = new NumberAxis();
        xAxis.setLabel("Number of Month");
        // creating the chart
        final LineChart lineChart = new LineChart(xAxis, yAxis);

        lineChart.setTitle("Stock Monitoring, 2010");
        // defining a series
        XYChart.Series series = new XYChart.Series<>();
        series.setName("My portfolio");
        // populating the series with data
        series.getData().add(new XYChart.Data(1, 23));
        series.getData().add(new XYChart.Data(2, 14));
        series.getData().add(new XYChart.Data(3, 15));
        series.getData().add(new XYChart.Data(4, 24));
        series.getData().add(new XYChart.Data(5, 34));
        series.getData().add(new XYChart.Data(6, 36));
        series.getData().add(new XYChart.Data(7, 22));
        series.getData().add(new XYChart.Data(8, 45));
        series.getData().add(new XYChart.Data(9, 43));
        series.getData().add(new XYChart.Data(10, 17));
        series.getData().add(new XYChart.Data(11, 29));
        series.getData().add(new XYChart.Data(12, 25));

        Scene scene = new Scene(lineChart, 800, 600);
        lineChart.getData().add(series);

        stage.setScene(scene);
        stage.show();

        lineChart.setOnMouseClicked(new EventHandler() {
            @Override
            public void handle(MouseEvent event) {
                Point2D xAxisInScene = xAxis.localToScene(new Point2D(0, 0));
                Point2D yAxisInScene = yAxis.localToScene(new Point2D(0, 0));
                double xInScene = event.getSceneX();
                double yInScene = event.getSceneY();
                double x = (xInScene - xAxisInScene.getX()) / xAxis.getScale() + xAxis.getLowerBound();
                double y = yAxis.getUpperBound() + (yInScene - yAxisInScene.getY()) / yAxis.getScale();

                System.out.printf("[%.1f, %.1f]%n", x, y);
            }
        });
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Tags: Java

Similar Questions

  • Hi, I am trying to download the Lightroom 6 stand-alone version and get the following message just after a click of the extraction area: "the account was registered to another country. Please log out and log in with an existing account for this country.

    Hi, I am trying to download the Lightroom 6 stand-alone version and get the following message just after a click of the extraction area: "the account was registered to another country. Please log out and log in with an existing account for this country. "I'm in Namibia and tried to change my country of Africa, in the USA, but still the same problem. TIA

    Hi Annen,

    Please see the following forum topic.

    Try to buy the trial period in a different e-mail - message error "error in your account order has been registered for another country. Please log out and log in with an existing account for this country. OK ".

    Kind regards

    Sumit Singh

  • change in value of ListBox on right click with the duration menu

    Hi all

    With the help of LV 2012...

    I have a listbox multicolumn containing a single column of text values.  I'm trying to implement the following features:

    Right click on an item will cause a runtime menu to open... user select 'Settings' in the menu and a dialog box with the settings specific to the element appears.

    The menu of the runtime has been easy.  The problem is that the value of the listbox (line) does not change with a single right-click.  I currently have to left click to change the value and then right click for the menu.  Any way to change the value with a right-click?

    Thank you!

    Charlie

    Rather than change the value, you can do something like this - use the mouse to the bottom? event for the listbox control. Because it is an event of filter, it must run everything first (although you will need to place a frame earlier in the structure of the event). Use the coords for this event and call Point to the method of lines of columns on the listbox. This will give you the line, now you can keep in a shift register. Do not throw the event, and this will cause the menu event, where you can now use the value of the line in front.

  • I do not have a button of the Firebox above the window of firefox. have tried to reset as do not have the toolbars. I have a right-click in the toolbar area-no options?

    Tried to add a menu toolbar or a toolbar of bookmarks. No options appear only when I click right in the toolbar area - or not to hide the toolbars. It was suggested to reset firefox by lowering a window by clicking the firefox button in the upper left corner. I don't have such a button. I'm frustrated and going around in circles. Your video on toolbars does not run. Pretend he does, but does nothing. I'm a Firefox user for years without any problem. Browser Firefox has diverted and unable to solve the problem because access is really a challenge. Avast suggested browser cleaning & even though it disappeared temporarily he returned. So I uninstalled Firefox and spent my allegiance to Google Crome. Favorite browser Firefox, however then reinstalled - and here I am. At the present time - not a satisfied customer! I'm running firefox on a Windows 7 operating system. I would try reinstalling but have already imported by bookmarks in Crome - this could be a part of the problem? Shouldn't be, I think. Thanks for any help.

    You were probably in mode full screen, if you had the ability to hide the toolbars in the context menu.

    You should also have seen the choice of exit full screen in this context menu.

    As reported above, pressing the key F11 will also toggle / disable mode full screen.

  • When you visit a particular site my user name is entered automatically when you click in the required area. I want to avoid this, how?

    This site requires a username to be filled in a specific area and in another box, you enter a series of numbers generated by a generator of numbers (so not a password - different series each time that you open a session).
    However I do not want my user name appears automatically in the first box. Trying to change that in the security settings (extra-options-security), there is a password section where you can choose any exceptions to the rule of the memory (if the box remember is marked). When clicking the exceptions button, the url of the site I'm talking about is not displayed, and it cannot be entered either, since you can't delete here.
    When you click on the option "saved passwords", nor the site, nor the username is listed. I think I've read all the help sections regarding usernames and passwords, but found no solution.
    How can I avoid this username (so only a user name - not the usename/password combination), appear in the box?

    Click on the box, hover over the drop-down menu with your mouse, if you select the word you want to delete, and then press the delete key. If Firefox fills automatically in forms of control

  • CFCHART: Remove values outside the chart areas

    Hello

    I use cfchart to build a pie chart, as well

    < chartwidth cfchart = '400 '.
    format = "jpg".
    ShowLegend = "false" >

    < cfchartseries type = "pie".
    Query = "users".
    ValueColumn = 'age '.
    PostesColonne = "name" >

    < / cfchart >

    However the circular diagram shows, and a number is presented outside the graph to sectors for each age value returned by the database, as shown in the picture as an attachment...

    Wondering how to disable those, so only the pie chart shows... with no numbers that surrounds

    Thank you very muchcfchart.jpg

    Never tried this, but "it might work" (and if it was Star Trek, it would always be):

    Try to set the attribute foregroundColor tag cfchart to the same value as your background of the chart. Try 'white' or even 'transparent '.

    -Fernis

  • First fall edition of Pro CC 2015: a Double click on the ICONS are not sent to clips in the viewer more

    Hi after upgrading to the 2015 fall from first Pro CC edition I had the problem that the double click on an icon in the tray will not send the clip to the viewer more. Only endless clicking on, or jumping to another clip following returning to my original clip of choice and eventually will work. It of incredibly tedious and slows down editing big time. Y at - it a new feature, adobe has put in place that I'm missing or is it just a bug? (the phenomenon occurs on my PowerMac and much portable more recent) Anyone else have this problem?

    Any help would be appreciated. Thank you!!!

    This is on Mac? If so, it is a known problem that is being developed. Possible solutions: select the first clip, then double-click or disable Hover Scrub (in the options of the menu of the project burger/wing Panel).

  • Published by "clicking" on the drawing area.

    Basically, I'm something I'm starting to notice that often drawing photoshop 'randomly' repeat my last action or makes a line where I clicked last. I can't explain why his past its very strange. I would like to know how to disable this since its very annoying.

    With the help of PS cs5 windows 7 64 bit.

    You probably have no idea what I'm talking about, so I'm including a video.

    Whatever it is problems of graphics card for mouse problems. Impossible to say. If she draws straight lines with a brush which can also indicate keyboard emits because these behaviors are related to the shift and Ctrl keys in some tools...

    Mylenium

  • Problem of setting a value for the hidden item click on the button with processes action or pl/sql dynamic

    Apex 4.1

    Oracle 11g

    I have a page which consists of a main and several sub-regions area.  I have a pl/sql process in after the header SET_DISPLAY(:P400_DISPLAY:='MAIN';))

    Three subregions have a contional show where P400_DISPLAY = STORE.  It works in the hiding of the sub regions.

    Now, I want to change the value P400_DISPLAY to the STORE to show the subregions when I hit a button.

    I tried to create a dynamic action for the click on the Add button, but get the following error:

    The selected button uses a model of 'button' that does not contain the #BUTTON_ID substitution string #.

    I went to the models and found:

    Substitution strings

    Top

    Substitution strings are used in sub models to reference the value of the components. This report details use of string substitution for this model.
    Substitution string Referenced De Description
    #LINK #.YesModelTo be used in an attribute "href".
    #JAVASCRIPT #.NO.To be used in an "onclick" attribute
    #LABEL #.YesModelButton label
    #BUTTON_ATTRIBUTES #.NO.The attributes button
    #BUTTON_ID #.NO.ID generated button will be ID either the static button if defined, or if not will be a generated ID internally in the format 'B ' | [Internal ID of the button.

    I then tried to create a page process, pl/sql,: P400_DISPLAY: = 'STORE '; If the button is pressed.  The action of the button is submit page. However, it does not change the value of P400_DISPLAY and the subregions are hidden.

    Suggestions please on how to fix the template or change the value of P400_DISPLAY?

    The question of the root, it's that, even if you change the value of the element of your page, it is not visible to other areas of the page until it is in the session. Thus, any other action based on the value of the element of your page. the visibility of a control, a report based on the value of the item, etc. will be affected by changing the value of the item page until it has been changed in the session. Even after that, items are stored in the session, then you must do something to influence the revalued value. To see the effect of this, observe that your page will load and assesses the value of the element of your page, it sees which is the "MAIN" and mask areas. However, he didn't reassess after that.

    Then; your choices for this value set at the session are send the page, or use JavaScript to set the value in the session. If you use the latter, you will have to do extra work to make visibility tests be re - run, so, let's stick with the submit method.

    What you did above sounds correct to do this but, there are a lot of decisions, that you might have done that may have caused things to do not occur in the correct order.

    First of all, we will confirm that what I describe above is your problem. From the development environment, load the page, click on the button to change the value and submit. Now, click on the link marked the Session. He is always at HAND? If the answer is "Yes"; That's your problem.

    Let's start with your calculation after the header. You set it to * only * run if the current value of the element of your page is null? If this isn't the case, it's your problem.

    Load the Page-> Item set to 'Hand' by calculation-> click on the button--> Item set to STORE-> Submit-> Page Load-> point by calculating the value 'hand '.

    See the problem?

    Assuming that's not the question, you have created a branch to the same page, right? What is your process for the branch point? Is it * after * Validation, computation etc.? Because if not, you are not changing the value before that didn't get to submit.

    I bet that's the first question, but take a look at these.

    See you soon,.

    -Joe

  • Sort by calculated value

    Hi guys,.

    I have a column in my rich text that displays the value calculated using the following syntax

    <? xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1) + ((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div ' 8')? >

    I need to have the data sorted in ascending order, by the above calculated value, I tried to use sort with the content of the support above, but somehow he refuses to add the content of FNDCD01, FNDCD02, etc., because they are of a different data type, strangely enough the XDOFX can display the sum properly... But I need to sort through it and perhaps to apply a conditional formatting based on the value of the calculation...

    It would be appreciated any help about it with gratitude.

    Kind regards

    Karine

    of JDE. F551721 F551721
    where
    F551721. WARRANTY8 = '5004181'
    Group of F551721. UKID, F551721. WARRANTY8, F551721. MCU, F551721. ALPH, F551721. ALKY
    Order of F551721. UKID, F551721. WARRANTY8]] >

    You use, just addition.

  • How to pass a value cannot be used in time during the Navigation target

    Hi all
    On a dashboard, I have a poster measure info bar chart by name each month (month name being on the x axis). The months displayed are based on a dashboard command prompt (year, month name) year-to-date.
    When I click on the bar of a month on the chart name, I use the Navigation target to open another query in the dashboard. The target a YEAR and MONTH "is requested. For example, if I click on 'MAY' bar, the other application opens to display data «CAN» Everything works.

    However, I need to do this not for the month selected as described above, but for the year to date instead. For example, I click on 'MAY' bar, I want the other application to display the data of 'JAN' thru 'MAY', not just 'CAN' itself. I'll do the same thing I have done to the request of the source, have a filter for the month number (not the name of the month) and have a 'BETWEEN 01 and xx' where ' xx will be calculated by taking the name of the month and using the number of months instead, so it would eventually "BETWEEN 01 and 05.

    Question: Is there a way I can pass the name of the month which was clicked on the chart and move on to the target, so I can use in a calculation and not the filter "is invited"?

    Thank you!

    _Analytics,

    I had the same solution but slightly different. It's different because you assumed this month as the number of months, but according to the scenario described by the user, is a name of months where the navigation must be done.

    user13033100,

    Here is the solution with an sine qua non - year should be fixed by default.
    Outside of having a main report and the subreport, create an additional report by month #, name of the month, call the "report additional sup.
    Now in the ' additional report under ' create filter of month name as "" is bringing"---> bar value from the master report is passed to this 'report additional sup '.
    Thus, month # column "additional sub of the report" gives you value months appropriate to limit the subreport.
    Month # of the report additional sup', create a filter on the column for the month in the subreport. The month filter sub report must be an advanced filter 'filter based on the results of another application', search for ' report additional sup ' month # column. In here a consumption below or equal operator.

    Quickly close the thread if replied/useful.

    -bifacts
    http://www.obinotes.com

    Published by: bifacts on October 21, 2010 14:12

  • Hide / show the area to click on the link

    Is it possible to see the region based on clicking on the link in the area of differentiation of the same page

    Published by: 893185 on April 30, 2012 13:42

    Hello
    Yes, you can do it.

    SELECT 'click to view' link,
    text_description from test_table;

    Lets say you have a region with static id "Show_Region" to be posted on click.


  • The feature "bookmark this tab" when right-clicking on the current tab is missing in MF4. Can I turn it back on?

    In Firefox 3, you could mark the active tab by right-clicking and selecting "the existing bookmark tab. In Firefox 4, which is now gone! Can I turn on somehow? Please help, I don't want any of my tabs, just a look at you... Thank you!

    Try right click in the content area of the page in the browser window, instead of on the tab itself.

  • Disability - Setup to ignore the movement unstable and irregular button of mouse clicks to the hand tremors.

    I feel the tremors in my wrist, hand and fingers. This means that my hand and fingers shake uncontrollably. These shocks, it is difficult for me to hold my mouse again, on a location. This also means that my unwanted finger marks, double-click. Yes, double-click. My trembling finger can double-click my mouse faster that I can do by intent.

    Is there a setting of the mouse or the mouse driver which can filter the agitation of my hand movements? Maybe it would identify fast movements that do not move in roughly the same direction.

    To solve the problem of double click, I offers an option for the mouse, double-click settings that would create a window of acceptable speeds double click. Instead of having only a recognition speed minimum double click, as we have now, the option applies to a maximum recognition double click speed. Double click would be ignored if the speed is too slow or too fast. This option would create a window or a legitimate speed range.

    Well, in any case. Does anyone know a solution to my problem of hand tremors?

    Dashboard-> Ease of Access Center-> make the mouse easier to use-> on make the mouse easier to use the window under See also (below), click on "mouse settings" (blue link) to open mouse properties-> click "Button" s tab, under double-click speed ", set the speed to your liking.» Double click on the small folder to test. Slow setting the folder opens and close to slow and high speed mouse clicks, while setting high speed works for mice high speed double click. In your case I would choose high-speed where the slow mouse double click on the parameters are ignored, while the speed slow settings double click of the mouse of high speed are not. I hope I could help

  • Clicks of the mouse do not work in IE9, Excel, iTunes and other programs.

    Clicks of the mouse are not working.  IE9, Excel, I-tunes and a few other programs.  It sometimes takes several mouse clicks, or in the case of IE9 when you activate the address bar or Favorites or even try to select a checkbox it seems that you must hold the button of the mouse down and after a few seconds, it will recognize the command.  With favorite IE9 you must hold down the mouse button and drag down to the place wherever you need to be communicated, then click on?  In Exel, the mouse cannot select multiple cells, in other programs her taking mulitple mouse clicks to highlight & copy text in the text example I've copied below from Microsoft answer Forum - I followed the instructions below and it did find and fix some problems, but there were others, he could not correct?  They were listed in another file, but I don't remember the name of the file, or how to access it?  I have run Norton 360 on my system and a complete analysis will detect all viruses?  Please advise?

    Thank you for using the Microsoft Answers forums. I suggest that you run the System File Checker. To use the tool (SFC.exe) System File Checker. To do this, follow these steps:

    Open an elevated command prompt. To do this, click Start, click programs, accessories principally made, right-click Guest, and then click Run as administrator. If you are prompted for an administrator password or a confirmation, type the password, or click on allow.

    Type the following command and press ENTER:

    sfc/scannow

    The sfc/scannow command. analysis of all protected system files and replaces incorrect versions with appropriate Microsoft versions

    Thank you

    Andrew Pugh

    Get your updated antivirus program and boot into Safe Mode. Note that some viruses can hide from your normal antivirus program, so you really need to scan in Safe Mode. To enter in Safe Mode when you turn on first, press F8 on every seconds until you get the menu, and then select Safe Mode. Then run a complete system scan.

    -

    Microsoft has suggestions and offerings to

    http://Windows.Microsoft.com/en-us/Windows7/how-do-I-remove-a-computer-virus

    -

    Moderator Forum Keith has a few suggestions along this line to

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-performance/Windows-Explorer-has-stopped-working/6ab02526-5071-4DCC-895F-d90202bad8b3

    -

    If that suits him fine. If this is not the case, use system restore to go back to an earlier date at the beginning of the problem. To run system restore, click Start-> programs-> Accessories-> System Tools-> system restore. Click on the box that says show more restore points.

    Finally if all else fails, you can look at the rather cryptic system event log. To do that click on start-> Control Panel-> administration-> event viewer tools. Once in Event Viewer system log-click and scroll entries looking for these "error" with indicator see if you can find guidance on where the problem may be.

    `

    When you get your system in good working condition, I invite you to back up your system up to an external hard drive and make it regular periodic updates.

    -

    I hope this helps. Good luck.

Maybe you are looking for