strange!!!

Discussion about JFreeChart related to stockmarket charts.
Locked
Tony Young
Posts: 14
Joined: Fri Nov 02, 2007 8:21 am

strange!!!

Post by Tony Young » Mon Nov 05, 2007 4:27 am

I've seen the codes in pakage "FC guide",
I wrote a program similar with the CandlestickChartDemo1.java
here is my program:

Code: Select all

public class temptest extends ApplicationFrame
{

    public temptest(String s)
    {
        super(s);
        OHLCDataset ohlcdataset = createDataset();
        JFreeChart jfreechart = createChart(ohlcdataset);
        jfreechart.getXYPlot().setOrientation(PlotOrientation.VERTICAL);
        ChartPanel chartpanel = new ChartPanel(jfreechart);
        chartpanel.setPreferredSize(new Dimension(500, 500));
        setContentPane(chartpanel);
    }

    private static JFreeChart createChart(OHLCDataset ohlcdataset)
    {
        JFreeChart jfreechart = ChartFactory.createCandlestickChart("Candlestick Demo", "Time", "Value", ohlcdataset, true);
        return jfreechart;
    }

    public static OHLCDataset createDataset()
    { ......//data........}

    public static JPanel createDemoPanel()
    {
        JFreeChart jfreechart = createChart(createDataset());
        return new ChartPanel(jfreechart);
    }

    public static void main(String args[])
    {
       temptest mytest= new temptest("mytest");
        candlestickchartdemo1.pack();
        RefineryUtilities.centerFrameOnScreen(mytest);
        mytest.setVisible(true);
    }
}
:?: :?: :?:
I've found nothing about dealing with mouse event...but it was performed well.
How can it be?!

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Mon Nov 05, 2007 7:14 am

small gnomes eating magic brownies that sit in your computer reading the JFreeChart sourcecode :shock:

Tony Young
Posts: 14
Joined: Fri Nov 02, 2007 8:21 am

Post by Tony Young » Mon Nov 05, 2007 8:21 am

Hi:jwenting
sorry....what's your meaning :shock: :shock: :shock: :shock:

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Mon Nov 05, 2007 12:39 pm

it happens automagically.

Taqua
JFreeReport Project Leader
Posts: 698
Joined: Fri Mar 14, 2003 3:34 pm
Contact:

Post by Taqua » Mon Nov 05, 2007 12:48 pm

.. or in other words: It happens in the ChartPanel class. You would have found it out by yourself quite easily if you would either look at the sourcecode *or* the JavaDocs for that class.

Use the source, Luke! Or at least read the documentation. If you believe in magic or hope that code snippets found in the Internet save you, you will only harm yourself. Using a tool wit just the firm believe in magic, you will end up shooting yourself in the foot with a magic wand.

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Mon Nov 05, 2007 3:34 pm

I like he magic brownies better 8)

Tony Young
Posts: 14
Joined: Fri Nov 02, 2007 8:21 am

Post by Tony Young » Tue Nov 06, 2007 2:44 am

Hi:
In default way, it zoomed in(out) when I dragged the mouse
But in my program, I want to use mouse wheel to zoom in or zoom out .
So I decide to write the method by myself, but I can't get any help from the source code, will someone explain me how to do this??

Locked