Resizing tick labels on a lineChart?

I have an application that makes heavy use of lineCharts. It would nice if, when expanding the JavaFX scene window, the ticklabels on my chart also expanded - they don't. I don't see any way in the documentation of making this happen - or am I missing something?
edited to add -
and failing that, is there a way to tell when my lineChart - or it's stage - is resized? I could use that information to achieve my desired result.
Edited by: 953258 on Sep 27, 2012 2:41 PM

Listen to the charts layoutBounds property and size the tick label font when the bounds change.
http://docs.oracle.com/javafx/2/api/javafx/scene/chart/Axis.html#tickLabelFontProperty
http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#layoutBoundsProperty

Similar Messages

  • Tick labels format in a dynamicaly generated graphic

    Hello all,
    I have a form in which the user select some parameters for the graphics.
    I have a grafic.ogd file which has 4 templates, parameters and procedures.
    Dependending on the selection in the form i drow the graphic dynamicaly with
    the following procedure:
    default_format='999,999,999,999';
    the_template := og_get_template(:template);
    qtype := OG_Sql_Qtype;
    qsource := :sqlquery;
    the_query := OG_Make_Query(Qtype, qsource);
    OG_Set_Name(the_query, 'q');
    --OG_Execute_Query(Query);
    /* set the name of the chart */
    emp_chart.chart_caob.name := 'achart';
    /* set the size of the plot frame */
    emp_chart.chart_caoc.frame.x := 1*OG_INCH;
    emp_chart.chart_caoc.frame.y := .4*OG_INCH;
    emp_chart.chart_caoc.frame.height := 3*OG_INCH;
    emp_chart.chart_caoc.frame.width := 3*OG_INCH;
    /* set the template and query to use */
    emp_chart.chart_caoc.template := the_template;
    emp_chart.chart_caoc.query := the_query;
    /* set the masks for all the above */
    emp_chart.chart_caob.mask := OG_NAME_GENERICA;
    emp_chart.chart_caog.mask := OG_NONE_GROUPA;
    emp_chart.chart_caoc.mask := OG_ALL_CHARTA;
    -- emp_chart.chart_caoc.mask := OG_TITLE_CHARTA;
    --emp_chart.chart_caoc.title := 'bla bla blA';
    /* make the chart */
    the_chart := og_make(emp_chart);
    indep_field.field_type := OG_INDEPENDENT;
    indep_field.colname := returnalias(1,:coloane);
    indep_field.ftname := 'field_tmp';
    /* insert it into the chart in the 0th position */
    og_insert_field(the_chart, indep_field, 0);
    i:=2;
    while i<=:nrcol loop
    dep_field.field_type := OG_DEPENDENT;
    dep_field.colname := returnalias(i,:coloane);
    dep_field.ftname := 'field_tmp';
    /* insert it into the chart in the last position */
    og_insert_field(the_chart, dep_field, OG_LAST);
    i:=i+1;
    end loop;
    /* execute the query for the first time */
    og_execute_query(the_query);
    settitle(:titlu);
    if length(:axaox) <> 0 then
    setxlabel(:axaox);
    end if;
    if length(:axaoy) <> 0 then
    setylabel(:axaoy);
    end if;
    if to_number(:maxs) <> 0 or to_number(:step) <> 0 then
    setscale(to_number(:mins), to_number(:step), to_number(:maxs));
    end if;
    /*acilea stabilim formatul de ticklabel*/
    axis_y := og_get_axis(the_template, og_y1_axis);
    axis_x := og_get_axis(the_template, og_x_axis);
    og_set_disc_numfmt(axis_y, default_format);
    og_set_disc_numfmt(axis_x, default_format);
    /* update the chart so the new field and query
    ** information will take effect */
    og_update_chart(the_chart, OG_ALL_CHUPDA);
    On the axis i have 500,000 and 1,000,000 tick labels. 500,000 is shown ok
    but 1,000,000 is something like that ########.
    It looks like og_set_disc_numfmt is not executed.
    If someone knows what's wrong please tell me!
    Thanx
    Costel Cirnmaru
    3S Computers & Communication

    Hello David,
    The reason for this problem is probably related to the FlateDecode compression described  in SAP Note 843480 (PDF conversion: Compression of bitmaps and TrueType fonts).
    Try switching off the usage of FlateDecode compression again via report RSTXPDF3 as described in Note #843480.
    It is a little confusing. The option 'FLATE_COMPR_OFF' needs to be set to 'On' to turn off the FlateDecode compression.
    To set this run as follows:
       se38 -> RSTXPDF3 -> enter 'FLATE_COMPR_OFF' in the 'Name' field
             -> Select 'Change Settings' radio button
    You will get a pop-up 'Do not use flat compression'.
    Select the 'on' button.
    After this create a new PDF and check if the problem is resovled.
    Regards,
    Aidan

  • JSlider: how to change tick label font?

    Hi,
    does anyone know how to change the tick labels font of a jSlider?
    Thanks for your help,
    Elke

    Just made this up, seems to work    Dictionary d = mySlider.getLabelTable();
        Enumeration e = d.elements();
        while (e.hasMoreElements()) {
          Object o = e.nextElement();
          if (o instanceof JComponent) ((JComponent)o).setFont(new Font("Dialog", 0, 9));
        }

  • How to resize a label automatically?

    Hi;
    I have a form and a label in it. That label should resize itself to fit the text in it. And after this resizing my code resize the form so that label fits in the form. The problem is, I dont know how to resize the label. (I dont mean label.setSize())
    I can try it with taking length of the text inside and calculate the length. But some characters are bigger than others. (for example: I and M) So there can be mistakes. Is label supporting such a thing?

    I don't know what you are talking about. As far as I can tell, the default behaviour for a JLabel is to resize itself to fit the text inside it. That's certainly how mine behave. So if yours don't do that then remove some code until they do.
    The exception is if they don't have enough room to expand because they're taking up the whole width of the panel they are in. You asked how to resize the form so that there will be room? I don't think that's a good idea. Windows that change their size are an annoying UI feature, which is why you rarely see them. And what happens when your form resizes itself to be three times as wide as your screen?
    However you might consider in future posting Swing questions in the Swing forum so you don't have to take advice from mediocre Swing programmers like me.

  • Set decimal tick label for number axis

    Hi everyone,
    In my chart, the number axis tick label is always like float number. I need an decimal number tick label. Because I use auto-range on this axis, i think this
    NumberAxis(double lowerBound, double upperBound, double tickUnit) is not good for me.
    Also, I have try setTickLabelFormatter on FX example, but for me, it seems like useful for set prefix and suffix. Can someone give me solution for this problem
    Edited by: pirent420 on 19:08 17-09-2012: add tag

    It doesn't work properly.
    You can look the link here:
    Before I use yours: before
    After I use yours: After
    It convert all number object to integer. So if my chart has 4 tick label like: 1.0, 1.25, 1.5 and 1.75, it conver to 1, 1, 1 and 1. It not what I looking for. If axis has 3 value: 1,2 and 3, I just want it present only 3 tick labels, not expand more tick label like 1.25, 1.5, 1.75 ....

  • Auto Tick Label Rotate, No Stagger

    Is it possible to have the O1 tick labels of a bar chart not stagger the labels when overlap is detected and instead move directly to label rotation? I had thought this might do the trick:
    <O1TickLabel tickLabelStaggered="false" automaticRotation="AR_HORIZ_ROTATE_90"/>
    It does not. It initially staggers when overlap is detected before moving to rotation when labels are cluttered enough that staggering no longer solves overlapping.
    I realize I can use this to have rotation used all the time:
    <O1TickLabel textRotation="TR_HORIZ_ROTATE_90" automaticRotation="AR_NO_ROTATE">
    But I like the idea of showing the labels straight across if they are sparse enough to fit.

    Test Screen Name, indeed it will be impossible to provide a fool-proof solution for innumerable printer/Adobe Reader combinations.
    I will be providing ready to print label sheets (not templates) on my web site. I reckon the users will be keen, but mostly have no IT skills.
    The sample sheet is a great idea as this would help reduce ink consumption on the test prints!
    I am keen for this to become a success and I would love to provide screenshots of printer settings.
    I run Linux on all my machines, so won't be able to obtain screenshots with any ease.
    I am working on the assumption that that 95% of PDF files are opened with Adobe Reader on Mac/Windows. Have you got any idea which are the nost common versions in the field now?

  • JSlider randomly missing tick labels

    Hello everyone,
    I am having a problem with JSliders. I have an application that has several JSliders throughout. They are vertical, min=100 and max=1000, with major ticks every 100, and minor ticks every 25, and the ticks and labels are painted.
    I have noticed that out of say 10 such sliders in my application, perhaps one or two sliders are randomly missing some ticks. For example, the labels will read 100, 200, 300, 400, 500, 600, 700, 900, 1000 (with the 800 just missing). The space for the text is there, but no text.
    As I mentioned, this doesn't always occur. It occurs perhaps on one or two sliders out of 10 every time I start the application. So this would seem to me to be related to a threading issue.
    Here is the constructor that creates the panel that has the JSlider in it:
           try{                                                                                                                                   
                SwingUtilities.invokeAndWait( new Runnable(){ public void run(){                                                                   
                    // INIT GUI & CUSTOM INIT                                                                                                      
                    initComponents();                                                                                                                                                                                                                          
                    depthJSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);                                                              
            catch(Exception e){ Util.handleExceptionNoRestart("Error building Log Table", e); }  
    Here is initComponents() which actually does the work:
        private void initComponents() {
            depthJSlider = new javax.swing.JSlider();                                                                                              
            depthJSlider.setMajorTickSpacing(100);                                                                                                 
            depthJSlider.setMaximum(1000);                                                                                                         
            depthJSlider.setMinimum(100);                                                                                                          
            depthJSlider.setMinorTickSpacing(25);                                                                                                  
            depthJSlider.setOrientation(javax.swing.JSlider.VERTICAL);                                                                             
            depthJSlider.setPaintLabels(true);                                                                                                     
            depthJSlider.setPaintTicks(true);                                                                                                      
            depthJSlider.setSnapToTicks(true);                                                                                                     
            depthJSlider.setToolTipText("<html>\n<b>Event Log Depth Slider</b><br>\nThis slider allows you to specify the maximum number of visible\
    events<br>\nwhen the \"Refresh Log\" or \"Start Auto-refresh\" buttons are pressed.</html>");                                                 
            depthJSlider.setMaximumSize(null);                                                                                                     
            depthJSlider.setMinimumSize(null);                                                                                                     
            depthJSlider.setPreferredSize(null);                                                                                                   
            gridBagConstraints = new java.awt.GridBagConstraints();                                                                                
            gridBagConstraints.gridx = 0;                                                                                                          
            gridBagConstraints.gridy = 0;                                                                                                          
            gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;                                                                        
            gridBagConstraints.weighty = 1.0;                                                                                                      
            gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 10);                                                                          
            tableJPanel.add(depthJSlider, gridBagConstraints);                                                                                     
             }Does anyone have any ideas at all why some of the labels might be missing?
    (Please drop a line to [email protected] if you have any thoughts!)
    Sincerely,
    Ian

    No problems in j2se 1.5.0
    import java.awt.*;
    import javax.swing.*;
    public class SliderTest {
        private JSlider getSlider() {
            JSlider slider = new javax.swing.JSlider();
            slider.setMajorTickSpacing(100);
            slider.setMaximum(1000);
            slider.setMinimum(100);
            slider.setMinorTickSpacing(25);
            slider.setOrientation(javax.swing.JSlider.VERTICAL);
            slider.setPaintLabels(true);
            slider.setPaintTicks(true);
            slider.setSnapToTicks(true);
            slider.setToolTipText("<html><b>Event Log Depth Slider</b>" +
                            "<br>This slider allows you to specify the maximum " +
                            "number of visible events<br>when the \"Refresh Log\" " +
                            "or \"Start Auto-refresh\" buttons are pressed.</html>");
            slider.setMaximumSize(null);
            slider.setMinimumSize(null);
            slider.setPreferredSize(null);
            return slider;
        private JPanel getPanel() {
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
            gridBagConstraints.weighty = 1.0;
            gridBagConstraints.weightx = 1.0;
            gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 10);
            for(int j = 0; j < 10; j++)
                panel.add(getSlider(), gridBagConstraints);
            return panel;
        public static void main(String[] args) {
            SliderTest test = new SliderTest();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test.getPanel());
            f.setSize(800,400);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Changing tick labels

    I have a slider with the initial major tick value as 50. I change the major ticks during runtime, but the label still remain as the default itself(that is 0.50,100). For eg, if i change the major tick to 20, i want the labels to change to 0,20,40..100. how can i do this?

    Hi Doug,
    For point 1, see this post:
    PIE CHART Label
    For point 2 - well, I don't think it is possible. Legend can only have column names, and it is not possible to change / assign the column names dynamically. Though it is possible to have dynamic parameters at other places in the graph, eg, the title, footnote, etc, but since the legend comes from column names in the data model, I don't think this is possible, unless you find a way to change the column names dynamically.
    Navneet.

  • How do I resize the label's icon?

    Hey!
    I currently have a label inside a scrollpane. When the user selects an image, the label's icon displays that image. However, I don't like the scrollbars, and would prefer it if I could resize the image to fit to the size of the label. Is this possible? How do I do that? Thanks in advance!

    You could set minimum and maximum dimensions for the JLabel. See JComponent.setMinimumSize(Dimension).

  • Tick Labels In Logarithmic Scaling?

    Hi!
    I am posting this in the .NET forum as well since if it is possible with version7 with MSVC .NET then we will switch to it:
    I am using MSVC++ 6 with MeasurementStudio6. I want to have the minor ticks have labels in logarithmic scaling when no major tick values are shown (e.g 3,23e+01..3,55e+01), with the scaling remaining in logarithmic mode. Is this possible with version6 or only in the .NET version. Please help since it is a very important issue. An example solution would be nice.
    Thanks,
    Miklos

    This question has been answered by another post at http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000ADCB0000&UCATEGORY_0=_48_%24_7_&UCATEGORY_S=0

  • Hide tick labels

    Is there a way to make the tick lables not visible? I believe I am trying to hide the y1TickLabel and the o1TickLabel for a graph.
    Thank You.
    - Charley

    Aneel,
    Thank you very much, that did what I was looking for. It is a little strange that the left side of each of the graphs still seem to have something there taking space. I guess that the Y axis labels are still there but just not visible. The x axis labels don't even seem to take any space.
    We are putting graph "thumbnails" on our page and the users do not want any text on the graph so this is a good solution.
    Thanks again.
    - Charley

  • Line Graph x axis tick label date format

    Hi to all,
    how can i format the date of the x axis label of a line graph?
    by now the date label is shown with a timestamp, e.g. 01.12.11 00:00.
    How can i change this to a simple date like 01.12.11?
    Please help. Thank you.
    Best regards
    Gunnar

    I would think that the datatype of the date attribute is a TimeStamp ? If yes changing it should help ..

  • Resize Labels created by wizard

    I used the wizard to create my form and now I can't figure out how to resize the labels that are next to my text boxes. If I make any changes to the property sheet it affects the text box not the label. What am I doing wrong.
    Thanks in advance.

    Hello,
    In the layout editor delete the default lable created.Create a new lable by selecting
    Text Option.These will be independent of text boxes.
    Cheers,
    Suresh

  • JSlider - Showing the labels only at the major tick points

    Hi
    I am using a vertical JSlider and I have the options to change the maximum and minimum values of the slider.
    The problem is that when the difference between minimum and maximum values are very high, a number of labels are displayed. As this difference increases, these labels will be overlapped and the labels become unreadable.
    I need to restrict the number of labels only to the major tick marks of the JSlider. Can anybody suggest a solution to show the tick labels only at the major tick points ??
    Thanks in advance.
    Regards
    Anoop

    You can show slider labels at whatever values you choose by using setLabelTable. Example:slider = new JSlider(); // default range, 0 - 100
    Hashtable<Integer, Component> labelTable = new Hashtable<Integer, Component>();
    labelTable.put(0, new JLabel("Zero"));
    labelTable.put(25, new JLabel("25"));
    labelTable.put(50, new JLabel("50"));
    labelTable.put(100, new JLabel("100!"));
    slider.setLabelTable(labelTable);
    slider.setPaintLabels(true);db

  • Is it possible to display a TickLabel on minor tick marks?

    I am trying to figure out whether it is possible to display a label on minor tick marks in a LineChart. I can't immediately gleam from the NumberAxis > ValueAxis > Axis javadoc how / if this could be possible to do. Tried experimenting a bit with making my own custom Axis class seeing if anything would pop when I started overriding methods, but no, not really.
    The issue I'm trying to solve is having the minor tick marks labeled on the chart when it is zoomed in. Currently, if I zoom in on a region contained between two major tick marks, there will be no axis labels at all (except the bottom left corner), which is unacceptable. I need to be able to label those minor ticks at some level of zoom to make the chart more readable.
    If anybody have any ideas on how to proceed with this problem, greatly appreciated.

    Bump. Is there any resolution for this issue?

Maybe you are looking for

  • IPhone feature requests

    I got my iPhone on 6/29 had time to really examine it. Below is a list of the iPhone features that I, as a power CINGULAR-8525 user, think should be included in iPhone upgrades. Most other phones on the market include these features. I was sooooo dis

  • Updateable recordset from a stored procedure

    I would like to retrieve an updateable recordset from a stored procedure using the oracle 9.2.0.2.0 oledb provider I am using the sample code/tables provided from Oracle. Does anyone have an example or has actually created an updatedable recordset fr

  • Problem printing static images vs camera tool snapshots

    Hi. This question might be a matter of formatting instead of a developer question but since it is related to some VBA code I am using I thought it would be appropriate to post here.  If it isn't, can someone let me know which forum would be more appr

  • Broken RH HTML 7 project

    I'm using RH HTML 7.0.3 on Windows XP Pro, SP3. Two disturbing symptoms have suddenly begun to occur, only within the last week. Symptom 1: In only one project, my compiled CHM file no longer displays browse sequences. Nothing relevant in the project

  • Solaris 10 and Oracle 10g

    I found several references pertaining to setting up oracle 10 on Solaris 10. We have setup the oracle.user projects and modified the shm-max-memory, but we are having an issue with the memory being segmented out into 4 segments via one key: ipcs -a I