Results 1 to 4 of 4
  1. #1
    Java Tip's Avatar
    Java Tip is offline Moderator
    Join Date
    Nov 2007
    Posts
    1,694
    Blog Entries
    430
    Rep Power
    9

    Default JFreeChart 1.0.11

    JFreeChart is a chart library for the Java platform that supports a wide range of charts including pie charts (2D and 3D), bar charts (horizontal and vertical, regular or stacked, with optional 3D-effects), line charts, XY plots, scatter plots, time series charts, high/low/open/close charts, candlestick plots, Gantt charts, Pareto charts, combination charts, and more. It is suitable for use in applications, applets, servlets, and JSP.

    Changes

    This release features a new chart theming mechanism to allow charts to be restyled conveniently, a new BarPainter mechanism to enhance the appearance of bar charts, a new XYShapeRenderer class, a scaling facility for the XYDrawableAnnotation for drawing the annotation within specific data coordinates, various other new classes (XYTaskDataset, XYDataImageAnnotation, and XYTitleAnnotation), a modification to the Year class to support an extended range, plus the usual slew of bugfixes and API improvements.

    URL: JFreeChart

  2. #2
    kunalfedex is offline Member
    Join Date
    Apr 2014
    Posts
    2
    Rep Power
    0

    Default Re: JFreeChart 1.0.11

    Hi,
    I am trying to create a Open-High-Low-close graph using JFreeChart 1.0.11. The code which generates the graph and saves it as a .png file is written in a function generateGraph(). When I call this function in main using eclipse the code works just fine and gives the expected output.

    But when I package this into a jar and deploy it on tomcat server, it generates blank .png file. Note while deploying it on server I remove main() function and pass the required parameters using a xsl file and passing these parameters as arguments to generateGraph() in the xsl.

    What could be the possible reason?

    Also instead of HighLowRenderer() i tried using XYLineandShapeRenderer() which works just fine even on the server. Problem is with OHLC rendering. I have used same versions of JFreeChart 1.0.11 jars both on eclipse as well as server.

  3. #3
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default Re: JFreeChart 1.0.11

    Hi,

    you replied to an post of 2008 about a software version that is outdated. Did you try to use the latest version? Or is there a reason why you stick to that version?

    Can you provide a small working example about your issue?

    What operating system is your application running on? If you are using windows and you run the tomcat sercer as service then the problem might be, that the HihjLowRenderer is using the SWT classes which then use native elements that are only available if you have a UI Session (Which services do not have). But that is just a guess from my side because I never checked SWT classes and what native elements they use so far.

    With kind regards,

    Konrad

  4. #4
    kunalfedex is offline Member
    Join Date
    Apr 2014
    Posts
    2
    Rep Power
    0

    Default Re: JFreeChart 1.0.11

    Hi Konard,

    Thanks for the quick reply.

    I am using this version of the software because the other charts have developed using this version of jfreechart and I am not sure if they would work with upgraded server.

    As you suspected, I am using Windows OS and running tomacat as windows service.
    But the other renderers work fine in such a scenario, could the problem be specifically for HighLowRenderer?

    this is function whic generates the graph:

    public void generateGrah()
    {
    XYItemRenderer renderer1 = new HighLowRenderer();


    JFreeChart chart=ChartFactory.createHighLowChart("HighLowClos e", "Date", "Price", data1, false);


    AffineTransform a = new AffineTransform();
    a.rotate(-Math.PI/4.0);

    XYPlot plot = chart.getXYPlot();
    NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
    DateAxis dateAxis = (DateAxis)plot.getDomainAxis();

    dateAxis.setLabelFont(dateAxis.getTickLabelFont(). deriveFont(a));
    dateAxis.setAutoRange(false);
    dateAxis.setVerticalTickLabels(true);


    DateFormat formatter = new SimpleDateFormat("d-MMM-yyyy");
    DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 1, formatter);
    dateAxis.setTickUnit(unit);




    rangeAxis.setAutoRange(true);
    rangeAxis.setAutoRangeIncludesZero(false);



    XYItemRenderer renderer= new XYLineAndShapeRenderer();
    XYItemRenderer renderer2=new HighLowRenderer();

    renderer2.setPaint(Color.BLACK);
    renderer2.setSeriesItemLabelsVisible(2,false);

    plot.setRenderer(0,renderer2);
    plot.setDataset(0,data1);
    plot.setRenderer(1,renderer);
    plot.setDataset(1,data1);


    ChartUtilities.applyCurrentTheme(chart);
    JPanel panel=new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(500, 270));
    demo.setContentPane(panel);
    demo.pack();
    RefineryUtilities.centerFrameOnScreen(demo);
    demo.setVisible(true);
    }


    This works fine in eclipse and I use same jfreechart jar in my classpath in eclipse as the server.

    Please help!

    Waiting in anticipation


    Thanks and Regards,
    kunalfedex

Similar Threads

  1. JFreeChart 1.0.8
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-27-2007, 08:27 PM
  2. JFreeChart 1.0.7
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-17-2007, 02:13 PM
  3. JFreeChart 1.0.5
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-10-2007, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •