From: Nathaniel G. A. <nat...@ya...> - 2004-09-14 00:44:13
|
You can not use two Data Axis on a Line Chart. You should use an XY Chart. --- jle...@ne... wrote: > Here is the code i use for generate the graphe > > //axe des x données > String[] xAxisLabels=this.x; //{ "1998", "1999", "2000", "2001", "2002", "2003", "2004" }; > //titre des axe > String xAxisTitle= "Jours"; > String yAxisTitle= "Valeurs"; > //titre du graphe > String title= "Glycémie"; > > DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title ); > > //Données en y > double[][] data= this.y;//new double[][]{ { 250, 45, -36, 66, 145, 80, 55 } , { 150, 15, 6, > 62, -54, 10, 84 }}; // > //legend > //this.maxJour > String[] legendLabels= new String[data.length]; > Paint[] paints = new Paint[data.length]; > Shape[] shapes = new Shape[data.length]; > Paint[] outlinePaints= new Paint[data.length]; > boolean[] fillPointFlags= new boolean[data.length]; > > for (int p=0;p<data.length;p++) > { > legendLabels[p]=null; > paints[p]=Color.blue; > shapes[p]=new Ellipse2D.Double(0,0,4,4); > fillPointFlags[p]=true; > outlinePaints[p]=Color.black; > > } > > //creation du grpahe > PointChartProperties pointChartProperties= new PointChartProperties( shapes, fillPointFlags, > outlinePaints ); > //creation des axe > AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, legendLabels, paints, > ChartType.POINT, pointChartProperties ); > dataSeries.addIAxisPlotDataSet( axisChartDataSet ); > > //ajout des deux lignes min et max > //data > double[][] mini=this.maxmin; > //appercu > Stroke[] > strokes={LineChartProperties.DEFAULT_LINE_STROKE,LineChartProperties.DEFAULT_LINE_STROKE}; > Shape[] shape={null,null}; > Paint[] p={Color.BLACK,Color.red}; > String[] legendLabelligne={"Seuil Minimum","Seuil Maximum"}; > LineChartProperties lineProp= new LineChartProperties(strokes, shape); > > axisChartDataSet=new AxisChartDataSet(mini,legendLabelligne,p,ChartType.LINE,lineProp); > dataSeries.addIAxisPlotDataSet(axisChartDataSet); > > //mise forme des echelles et du final > ChartProperties chartProperties= new ChartProperties(); > > > DataAxisProperties x=new DataAxisProperties(); > DataAxisProperties y=new DataAxisProperties(); > > > > //DataAxisProperties datatry = (DataAxisProperties)axisProperties.getXAxisProperties(); > x.setNumItems(this.intervalle); > x.setUserDefinedScale(0,24); > x.setRoundToNearest(0); > > //DataAxisProperties dataAxisProperties= > (DataAxisProperties)axisProperties.getYAxisProperties(); > //calcul de la meilleur echelle possible > int n=(int)Math.ceil(new Double(String.valueOf(this.valeurMax/100)).doubleValue()); > y.setNumItems(n+2); > y.setUserDefinedScale( 0, 100 ); > y.setRoundToNearest( 0 ); > > > AxisProperties axisProperties= new AxisProperties((LabelAxisProperties)x,y); > > //ligne pour le cadrillage > ChartStroke xAxisGridLines= new ChartStroke( new BasicStroke( 0.5f ), Color.GRAY ); > axisProperties.getXAxisProperties().setGridLineChartStroke( xAxisGridLines ); > > axisProperties.getXAxisProperties().setShowGridLines(AxisTypeProperties.GRID_LINES_ONLY_WITH_LABELS); > axisProperties.getXAxisProperties().setShowTicks( AxisTypeProperties.TICKS_NONE ); > axisProperties.getXAxisProperties().setPaddingBetweenAxisAndLabels(5.0f); > > //generation finale > AxisChart axisChart= new AxisChart( dataSeries, chartProperties, axisProperties,null, 700, 500 > ); > > > >Message: 2 > >Date: Sun, 5 Sep 2004 08:46:19 -0700 (PDT) > >From: "Nathaniel G. Auvil" <nat...@ya...> > >Subject: Re: [jCharts-users] RE: Scale of a Xaxis NullPointerException > >To: jch...@li... > >Reply-To: jch...@li... > > > > > >Can you attach your code with the data? > > > > > > > > > >--- jle...@ne... wrote: > > > >> here is the stacktrace > >> > >> > >> java.lang.NullPointerException > >> render > >> org.jCharts.axisChart.axis.XAxis > >> -1 > >> renderChart > >> org.jCharts.axisChart.AxisChart > >> -1 > >> render > >> org.jCharts.Chart > >> -1 > >> render > >> org.jCharts.encoders.BinaryEncoderUtil > >> -1 > >> encode > >> org.jCharts.encoders.JPEGEncoder13 > >> -1 > >> getGraphe > >> com.GrapheScatter > >> 308 > >> main > >> com.EssaiGrpahe > >> 46 > >> null > >> null > >> > >> i use this code for see them > >> > >> System.out.println(f.getClass().getName()); > >> StackTraceElement stcak[]=f.getStackTrace(); > >> for (int t=0;t<stcak.length;t++) > >> { > >> System.out.println(stcak[t].getMethodName()); > >> System.out.println(stcak[t].getClassName()); > >> System.out.println(stcak[t].getLineNumber()); > >> } > >> System.out.println(f.getMessage()); > >> System.out.println(f.getLocalizedMessage()); > >> > >> >Message: 2 > >> >Date: Wed, 01 Sep 2004 03:49:22 -0400 > >> >From: jle...@ne... > >> >To: jch...@li... > >> >Subject: [jCharts-users] Scale of a Xaxis NullPointerException > >> >Reply-To: jch...@li... > >> > > >> >I don't know why i have a NullPointerException when i use the jpeg encoder > >> >Is there anaone could help me..... > >> >It is always the same problem with the scale of the xaxis on a point chart > >> > > >> > > >> >DataAxisProperties x=new DataAxisProperties(); > >> > DataAxisProperties y=new DataAxisProperties(); > >> > > >> > > >> > > >> > //DataAxisProperties datatry = (DataAxisProperties)axisProperties.getXAxisProperties(); > >> > x.setNumItems(this.intervalle); > >> > x.setUserDefinedScale(0,24); > >> > x.setRoundToNearest(0); > >> > > >> > //DataAxisProperties dataAxisProperties= (DataAxisProperties) > >> axisProperties.getYAxisProperties(); > >> > //calcul de la meilleur echelle possible > >> > int n=(int)Math.ceil(new Double(String.valueOf(this.valeurMax/100)).doubleValue()); > >> > y.setNumItems(n+2); > >> > y.setUserDefinedScale( 0, 100 ); > >> > y.setRoundToNearest( 0 ); > >> > > >> > > >> > AxisProperties axisProperties= new AxisProperties((LabelAxisProperties)x,y); > >> > > >> > //ligne pour le cadrillage > >> > ChartStroke xAxisGridLines= new ChartStroke( new BasicStroke( 0.5f ), Color.GRAY ); > >> > axisProperties.getXAxisProperties().setGridLineChartStroke( xAxisGridLines ); > >> > axisProperties.getXAxisProperties().setShowGridLines( > >> AxisTypeProperties.GRID_LINES_ONLY_WITH_LABELS); > >> > axisProperties.getXAxisProperties().setShowTicks( AxisTypeProperties.TICKS_NONE ); > >> > axisProperties.getXAxisProperties().setPaddingBetweenAxisAndLabels(5.0f); > >> > > >> > > >> > //generation finale > >> > AxisChart axisChart= new AxisChart( dataSeries, chartProperties, axisProperties,null, > 700, > >> 500 ); > >> > > >> > > >> > // axisChart.xAxis=new XAxis(axisChart,this.intervalle); > >> > > >> > try{ > >> > JPEGEncoder13.encode(axisChart,1.0f,new > >> FileOutputStream(prop.getProperty("GRAPHE")+chemin+".jpg")); > >> > } > >> > > >> >__________________________________________________________________ > >> >Switch to Netscape Internet Service. > >> >As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register > >> > > >> >Netscape. Just the Net You Need. > >> > > >> >New! Netscape Toolbar for Internet Explorer > >> >Search from anywhere on the Web and block those annoying pop-ups. > >> >Download now at http://channels.netscape.com/ns/search/install.jsp > >> > > >> > > >> >Message: 6 > >> >Date: Wed, 1 Sep 2004 19:51:29 -0700 (PDT) > >> >From: "Nathaniel G. Auvil" <nat...@ya...> > >> >Subject: Re: [jCharts-users] Scale of a Xaxis NullPointerException > >> >To: jch...@li... > >> >Reply-To: jch...@li... > >> > > >> > > >> >can you attach the stacktrace? > >> > > >> > > >> > > >> >--- jle...@ne... wrote: > >> > > >> >> I don't know why i have a NullPointerException when i use the jpeg encoder > >> >> Is there anaone could help me..... > >> >> It is always the same problem with the scale of the xaxis on a point chart > >> >> > >> >> > >> >> DataAxisProperties x=new DataAxisProperties(); > >> >> DataAxisProperties y=new DataAxisProperties(); > >> >> > >> >> > >> >> > >> >> //DataAxisProperties datatry = > (DataAxisProperties)axisProperties.getXAxisProperties(); > >> >> x.setNumItems(this.intervalle); > >> >> x.setUserDefinedScale(0,24); > >> >> x.setRoundToNearest(0); > >> >> > >> >> //DataAxisProperties dataAxisProperties= (DataAxisProperties) > >> >> axisProperties.getYAxisProperties(); > >> >> //calcul de la meilleur echelle possible > >> >> int n=(int)Math.ceil(new Double(String.valueOf(this.valeurMax/100)).doubleValue()); > >> >> y.setNumItems(n+2); > >> >> y.setUserDefinedScale( 0, 100 ); > >> >> y.setRoundToNearest( 0 ); > >> >> > >> >> > >> >> AxisProperties axisProperties= new AxisProperties((LabelAxisProperties)x,y); > >> >> > >> >> //ligne pour le cadrillage > >> >> ChartStroke xAxisGridLines= new ChartStroke( new BasicStroke( 0.5f ), Color.GRAY ); > >> >> axisProperties.getXAxisProperties().setGridLineChartStroke( xAxisGridLines ); > >> >> axisProperties.getXAxisProperties().setShowGridLines( > >> >> AxisTypeProperties.GRID_LINES_ONLY_WITH_LABELS); > >> >> axisProperties.getXAxisProperties().setShowTicks( AxisTypeProperties.TICKS_NONE ); > >> >> axisProperties.getXAxisProperties().setPaddingBetweenAxisAndLabels(5.0f); > >> >> > >> >> > >> >> //generation finale > >> >> AxisChart axisChart= new AxisChart( dataSeries, chartProperties, axisProperties,null, > >> 700, > >> >> 500 ); > >> >> > >> >> > >> >> // axisChart.xAxis=new XAxis(axisChart,this.intervalle); > >> >> > >> >> try{ > >> >> JPEGEncoder13.encode(axisChart,1.0f,new > >> >> FileOutputStream(prop.getProperty("GRAPHE")+chemin+".jpg")); > >> >> } > >> >> > >> >> __________________________________________________________________ > >> >> Switch to Netscape Internet Service. > >> >> As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register > >> >> > >> >> Netscape. Just the Net You Need. > >> >> > >> >> New! Netscape Toolbar for Internet Explorer > >> >> Search from anywhere on the Web and block those annoying pop-ups. > >> >> Download now at http://channels.netscape.com/ns/search/install.jsp > >> >> > >> >> > >> >> ------------------------------------------------------- > >> >> This SF.Net email is sponsored by BEA Weblogic Workshop > >> >> FREE Java Enterprise J2EE developer tools! > >> >> Get your free copy of BEA WebLogic Workshop 8.1 today. > >> >> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >> >> _______________________________________________ > >> >> jCharts-users mailing list > >> >> jCh...@li... > >> >> https://lists.sourceforge.net/lists/listinfo/jcharts-users > >> >> > >> > > >> > > >> > > >> > > >> >__________________________________ > >> >Do you Yahoo!? > >> >New and Improved Yahoo! Mail - Send 10MB messages! > >> >http://promotions.yahoo.com/new_mail > >> > > >> > > >> > > >> >-- __--__-- > >> > > >> >_______________________________________________ > >> >jCharts-users mailing list > >> >jCh...@li... > >> >https://lists.sourceforge.net/lists/listinfo/jcharts-users > >> > > >> > > >> >End of jCharts-users Digest > >> > > >> > >> __________________________________________________________________ > >> Switch to Netscape Internet Service. > >> As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register > >> > >> Netscape. Just the Net You Need. > >> > >> New! Netscape Toolbar for Internet Explorer > >> Search from anywhere on the Web and block those annoying pop-ups. > >> Download now at http://channels.netscape.com/ns/search/install.jsp > >> > >> > >> ------------------------------------------------------- > >> This SF.Net email is sponsored by BEA Weblogic Workshop > >> FREE Java Enterprise J2EE developer tools! > >> Get your free copy of BEA WebLogic Workshop 8.1 today. > >> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >> _______________________________________________ > >> jCharts-users mailing list > >> jCh...@li... > >> https://lists.sourceforge.net/lists/listinfo/jcharts-users > >> > > > > > > > > > >__________________________________ > >Do you Yahoo!? > >Yahoo! Mail - 50x more storage than other providers! > >http://promotions.yahoo.com/new_mail > > > > > >--__--__-- > > > >Message: 3 > >Date: Mon, 06 Sep 2004 00:10:47 +0200 > >From: Piet Crombach <pie...@ho...> > >To: jch...@li... > >Subject: Re: [jCharts-users] Hi I'm new to jChart - Question: Example how > > to use data from a MDBS > >Reply-To: jch...@li... > > > >Nathaniel G. Auvil wrote: > > > >Yes I did. I found out to generate graphs in my application. And read > >also a lot of the mailing list. So far I did not found an adequate > >answer for the 2 quetions. I wil find out like I found a lot by trial > >and error. But if there is somebody who wrote some code lI asked for it > >would be a big help and a lot easier to learn. > >In the samples and documentation there are only samples for a single > >graph on a single page. I want graphs embedded in some other HTML > >dynamically. > >Now I stream graphs to a temp dir and then I build the page with img > >placeholders for the graphs. I understand there is a more elgant > >solutiion???? > > > >>Did you look at the samples and documentation? > >> > >> > >> > >>--- Piet Crombach <pie...@ho...> wrote: > >> > >> > >> > >>>Hi, > >>> > >>>I'm trying to do usefull things with jCharts. The best way to learn is > >>>looking at working examples. > >>> > >>>I need 2 examples now: > >>> > >>>1. How do I pass data from a RDBMS to a chart > >>>2. How to pass a chart to a dynamic *.jsp page. > >>> > >>>thanks > >>> > >>> > >>> > >>> > >>>------------------------------------------------------- > >>>This SF.Net email is sponsored by BEA Weblogic Workshop > >>>FREE Java Enterprise J2EE developer tools! > >>>Get your free copy of BEA WebLogic Workshop 8.1 today. > >>>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >>>_______________________________________________ > >>>jCharts-users mailing list > >>>jCh...@li... > >>>https://lists.sourceforge.net/lists/listinfo/jcharts-users > >>> > >>> > >>> > >> > >> > >>__________________________________________________ > >>Do You Yahoo!? > >>Tired of spam? Yahoo! Mail has the best spam protection around > >>http://mail.yahoo.com > >> > >> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by BEA Weblogic Workshop > >>FREE Java Enterprise J2EE developer tools! > >>Get your free copy of BEA WebLogic Workshop 8.1 today. > >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >>_______________________________________________ > >>jCharts-users mailing list > >>jCh...@li... > >>https://lists.sourceforge.net/lists/listinfo/jcharts-users > >> > >> > >> > > > > > > > > > >--__--__-- > > > >_______________________________________________ > >jCharts-users mailing list > >jCh...@li... > >https://lists.sourceforge.net/lists/listinfo/jcharts-users > > > > > >End of jCharts-users Digest > > > > __________________________________________________________________ > Switch to Netscape Internet Service. > As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register > > Netscape. Just the Net You Need. > > New! Netscape Toolbar for Internet Explorer > Search from anywhere on the Web and block those annoying pop-ups. > Download now at http://channels.netscape.com/ns/search/install.jsp > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jCharts-users mailing list > jCh...@li... > https://lists.sourceforge.net/lists/listinfo/jcharts-users > __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |