From: Nathaniel G. A. <nat...@ya...> - 2003-06-21 19:14:09
|
What version of jCharts are you using? What version jdk? what platform? Can you send your code, or code to make this happen? I can not reproduce this with 0.7.3 --- Rainer Romatka <rai...@at...> wrote: > As requested by Nathaniel, here is an example of a chart with the label > for the vertical axis at 45 degrees and not quite at the right location. > > ATTACHMENT part 2.1 application/applefile name=45degreeSample.jpg > ATTACHMENT part 2.2 image/jpeg x-mac-creator=38454C45; x-unix-mode=0644; x-mac-type=4A504547; name=45degreeSample.jpg > > > > The data for these charts comes from a database and the code for the > chart creation is not 100% stand-alone but fairly self contained: > > public Chart createChart() > { > int horizontalCategoryCount = mHorizontalCategoryToValueMap.size(); > int verticalCategoryCount = mVerticalCategorySet.size(); > > double[][] data = new > double[verticalCategoryCount][horizontalCategoryCount]; > Paint[] paints = new Paint[verticalCategoryCount]; > String[] horizontalLabels = new String[horizontalCategoryCount]; > String[] verticalLabels = new String[verticalCategoryCount]; > > int horizontalCategoryIndex = 0; > for ( Iterator horizontalCategoryIter = > mHorizontalCategoryToValueMap.entrySet().iterator(); > horizontalCategoryIter.hasNext(); /* */) > { > Map.Entry entry = (Map.Entry)horizontalCategoryIter.next(); > IDBObjectCategory horizontalCategory = > (IDBObjectCategory)entry.getKey(); > HorizontalCategoryData horizontalEntry = > (HorizontalCategoryData)entry.getValue(); > > int verticalCategoryIndex = 0; > for ( Iterator verticalCategoryIter = > mVerticalCategorySet.iterator(); > verticalCategoryIter.hasNext(); /* */) > { > IDBObjectCategory verticalCategory = null; > try > { > verticalCategory = (IDBObjectCategory)verticalCategoryIter.next(); > double value = horizontalEntry.value( verticalCategory); > data[verticalCategoryIndex][horizontalCategoryIndex] = value; > ++verticalCategoryIndex; > } > catch( Exception e) > { > cat.error( "Exception extracting value. Horizontal Index: " + > horizontalCategoryIndex + > " Vertical index: " + verticalCategoryIndex + > " (Category: " + verticalCategory.toString(), e); > throw new IllegalStateException( "Exception extracting value"); > } > } > > horizontalLabels[horizontalCategoryIndex] = horizontalCategory.name( > mLocale); > > ++horizontalCategoryIndex; > } > > int verticalCategoryIndex = 0; > for ( Iterator verticalCategoryIter = mVerticalCategorySet.iterator(); > verticalCategoryIter.hasNext(); /* */) > { > IDBObjectCategory verticalCategory = > (IDBObjectCategory)verticalCategoryIter.next(); > paints[verticalCategoryIndex] = ChartServlet.chartColor( > verticalCategoryIndex); > verticalLabels[verticalCategoryIndex] = verticalCategory.name( > mLocale); > ++verticalCategoryIndex; > } > > String horizAxisTitle = mHorizAxisCategoryGrouper.displayName( > mLocale); > String vertAxisTitle = mObjDef.getPropertyDefinition( > mValuePropName).getTitle( mLocale); > > DataSeries dataSeries = new DataSeries( horizontalLabels, > horizAxisTitle, vertAxisTitle, mTitle); > StackedBarChartProperties stackedBarChartProperties= new > StackedBarChartProperties(); > AxisChartDataSet axisChartDataSet = null; > try > { > axisChartDataSet = > new AxisChartDataSet( data, verticalLabels, paints, mChartType, > stackedBarChartProperties ); > } > catch( ChartDataException e) > { > cat.error( "Exception creating data set for pie chart", e); > } > dataSeries.addIAxisPlotDataSet( axisChartDataSet); > > // ---to make this plot horizontally, pass true to the > AxisProperties Constructor > // AxisProperties axisProperties= new AxisProperties( true ); > AxisProperties axisProperties= new AxisProperties(); > > return new AxisChart( dataSeries, chartProperties(), axisProperties, > legendProperties(), mWidth, mHeight); > } > > Any help would be much appreciated. > > Thanks, > > Rainer ===== http://nathaniel-auvil.blog-city.com/ __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |