Re: How to render Axis Charts

David Han <[email protected]> Tue, 9 Mar 2004 15:45:28 -0500
Newsgroups gmane.comp.krysalis.jcharts.user
Message-ID <a0521063cbc73da348576@[128.183.190.142]>
I know you have to repaint the screen every time you resize your 
screen.  But my problem with JDK 1.4.1 on Mac OS X 10.2 is nothing 
gets displayed when you run the program first time from the command 
line.  It just sits there and does nothing.  But if you run the same 
program against 1.4.2 (that is only available for OS X 10.3), all the 
components are displayed properly (as far as I can tell).  But you 
see an error message in the chart that says "problems" in italics 
bold at the bottom of the screen.  So something is not being 
interpreted properly.  It works beautifully on Linux.  I'll try this 
on Windows, Solaris, and DEC Alpha and report the outcome in about 2 
weeks.


I'm having this problem wh
>are you sure you are not simply having problems with having the 
>chart repaint itself? If yuo
>change the size of the window or component, repaint() gets called on 
>that component so you need to
>ooverride this method to redraw the chart.
>
>
>
>--- David Han <[email protected]> wrote:
>>  Just tried the same program on Mac OS X 10.3 with JDK 1.4.2.  Graph
>>  shows up, but not everything gets displayed properly.  This is still
>>  much better than 1.4.1 that just sits there and does nothing.
>>
>>  David
>>
>>
>>  >Never mind - nothing is wrong with my code.  My code works fine on
>>  >Linux, but it doesn't work on Mac OS X with JDK 1.4.1.  I'll try my
>>  >code with JDK 1.4.2 on Mac OS X and see if that works.  Will keep
>>  >you posted.
>>  >
>>  >David
>>  >
>>  >>>did you look at the SwingDemo in the demo package?
>>  >>
>>  >>
>>  >>Yes, I did look prior to posting my message.  I don't any
>>  >>difference between my code and the SwingDemo.java code.  What is my
>>  >>code missing?
>>  >>
>>  >>    private void initComponents() throws ChartDataException, 
>>PropertyException
>>  >>    {
>>  >>       this.setSize( width, height );
>>  >>       this.panel = new JPanel( true );
>>  >>       this.panel.setSize( width, height );
>>  >>       this.getContentPane().add( this.panel );
>>  >>       this.setVisible( true );
>>  >>
>>  >>       String[] xAxisLabels = { "1998", "1999", "2000", "2001",
>>  >>                                "2002", "2003", "2004" };
>>  >>       String xAxisTitle = "Years";
>>  >>       String yAxisTitle = "Problems";
>>  >>       String title = "Micro$haft at Work";
>>  >>       DataSeries dataSeries = new DataSeries(xAxisLabels, xAxisTitle,
>>  >>                                              yAxisTitle, title );
>>  >>
>>  >>       double[][] data = new double[][]{ { 250, 45, -36, 66, 
>>145, 80, 55 } };
>>  >>       String[] legendLabels = { "Bugs" };
>>  >>       Paint[] paints = {Color.blue};
>>  >>
>>  >>       Stroke[] strokes = { LineChartProperties.DEFAULT_LINE_STROKE };
>>  >>       Shape[]  shapes  = { PointChartProperties.SHAPE_CIRCLE };
>>  >>       LineChartProperties lineChartProperties = new
>>  >>LineChartProperties(strokes, shapes
>>  >>);
>>  >>
>>  >>       AxisChartDataSet axisChartDataSet =
>>  >>              new AxisChartDataSet(data, legendLabels, paints, 
>>ChartType.LINE,
>>  >>                                   lineChartProperties );
>>  >>       dataSeries.addIAxisPlotDataSet (axisChartDataSet);
>>  >>
>>  >>       ChartProperties chartProperties   = new ChartProperties();
>>  >>       AxisProperties axisProperties     = new AxisProperties();
>>  >>       LegendProperties legendProperties = new LegendProperties();
>>  >>
>>  >>       AxisChart axisChart= new AxisChart(dataSeries, chartProperties,
>>  >>                                          axisProperties, 
>>legendProperties,
>>  >>                                          450, 450);
>>  >>       axisChart.setGraphics2D ( (Graphics2D) this.panel.getGraphics() );
>>  >>       axisChart.render();
>>  >>}
>>  >>
>>  >>
>>  >>--
>>  >>David Han
>>  >>[email protected]
>>  >>301-286-3617
>>  >>
>>  >>
>>  >>-------------------------------------------------------
>>  >>This SF.Net email is sponsored by: IBM Linux Tutorials
>>  >>Free Linux tutorial presented by Daniel Robbins, President and CEO of
>>  >>GenToo technologies. Learn everything from fundamentals to system
>  > >>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>>  >>_______________________________________________
>>  >>jCharts-users mailing list
>>  >>[email protected]
>>  >>https://lists.sourceforge.net/lists/listinfo/jcharts-users
>>  >
>>  >
>>  >--
>>  >David Han
>>  >[email protected]
>>  >301-286-3617
>>  >
>>  >
>>  >-------------------------------------------------------
>>  >This SF.Net email is sponsored by: IBM Linux Tutorials
>>  >Free Linux tutorial presented by Daniel Robbins, President and CEO of
>>  >GenToo technologies. Learn everything from fundamentals to system
>>  >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>>  >_______________________________________________
>>  >jCharts-users mailing list
>>  >[email protected]
>>  >https://lists.sourceforge.net/lists/listinfo/jcharts-users
>>
>>
>>  --
>>  David Han
>>  [email protected]
>>  301-286-3617
>>
>>
>>  -------------------------------------------------------
>>  This SF.Net email is sponsored by: IBM Linux Tutorials
>>  Free Linux tutorial presented by Daniel Robbins, President and CEO of
>>  GenToo technologies. Learn everything from fundamentals to system
>>  administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>>  _______________________________________________
>>  jCharts-users mailing list
>>  [email protected]
>>  https://lists.sourceforge.net/lists/listinfo/jcharts-users
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Search - Find what youĂ­re looking for faster
>http://search.yahoo.com
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: IBM Linux Tutorials
>Free Linux tutorial presented by Daniel Robbins, President and CEO of
>GenToo technologies. Learn everything from fundamentals to system
>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>_______________________________________________
>jCharts-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jcharts-users


-- 
David Han
[email protected]
301-286-3617


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click