jCharts用户指南翻译第六章 轴图表

6.轴图表

 这是轴图表部分

6.1通用部分

引言

用户指南这部分包含了大部分通用的东西,并不是轴图表的全部。

舍入

默认地,Y轴舍入最接近的这个数值。用DataAxisProperties对象的一个方法可以改变。

警告:

备注:当用一个用户定义的范围,你注意你的增加会通过这个舍入因子来舍入。

下面例子来设置y轴的舍入到大约1/100或者10-2'nd精确度

 

DataAxisProperties dataAxisProperties= (DataAxisProperties) axisProperties.getYAxisProperties();

dataAxisProperties.setRoundToNearest( -2 );

             

轴标签

字体

                      

垂直X轴标签

   默认地,X轴标签时带有刻度下水平呈现的。在AxisProperties

对象上,通过利用一个方法改变成垂直的。以下例子,设置了x轴标签是在90度角度呈现的。

                       axisProperties = new AxisProperties( false );

                       axisProperties.setXAxisLabelsAreVertical( true );

        

变形的X轴标签

默认地,X轴标签时再有刻度水平地呈现的。在AxisProperties

对象上,通过利用一个方法改变成角度的。这标签时在text标签顶中间 的中心位置。

  警告:

  备注:这标签的旋转值在0 90,比范围或大或少地角度行为是没定义的。

  以下例子,设置了x轴标签是在30度角度呈现的。

 

               AxisProperties axisProperties= new AxisProperties( false );

               axisProperties.getXAxisProperties().setLabelRotationAngle(30);

                      

 

6.2区域图表

  这里是一些产生区域图表的代码。你可以在它绘制时,发送1 ..n数据集。

String[] xAxisLabels= { "1998", "1999", "2000", "2001",

                                     "2002", "2003", "2004" };

String xAxisTitle= "Years";

String yAxisTitle= "Problems";

String title= "Micro$oft at Work";

DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title );

 

 

double[][] data= new double[][]{ { 250, 45, -36, 66, 145, 80, 55  },

                                 { 50, 145, 6, 166, 105, 110, 85  } };

String[] legendLabels= { "Bugs", "FUD Towards Gnu/Linux" };

Paint[] paints= new Paint[] { new Color( 153, 0, 255 ,100 ),

                              new Color( 204,0,255, 150 ) };

 

AreaChartProperties areaChartProperties= new AreaChartProperties();

AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, legendLabels,

                                                         paints, ChartType.AREA,

                                                         areaChartProperties );

 

dataSeries.addIAxisPlotDataSet( axisChartDataSet );

 

ChartProperties chartProperties= new ChartProperties();

AxisProperties axisProperties= new AxisProperties();

LegendProperties legendProperties= new LegendProperties();

 

AxisChart axisChart= new AxisChart( dataSeries, chartProperties,

                                    axisProperties, legendProperties,

                                    AxisChartsGuide.width, AxisChartsGuide.height );

       

 

重叠区域图表

    这里是一些产生区域图表的代码。你可以在它绘制时,发送1 ..n数据集。

String[] xAxisLabels= { "1998", "1999", "2000", "2001",

                          "2002", "2003", "2004" };

String xAxisTitle= "Years";

String yAxisTitle= "Problems";

String title= "Micro$oft at Work";

DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle,

                                        yAxisTitle, title );

 

 

double[][] data= new double[][]{ { 250, 45, -36, 66, 145, 80, 55  },

                                 { 250, 45, -36, 66, 145, 80, 55  } };

String[] legendLabels= { "Bugs", "Security Holes" };

Paint[] paints= TestDataGenerator.getRandomPaints( 2 );

 

AreaChartProperties areaChartProperties= new AreaChartProperties();

AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值