本文整理汇总了Java中org.jCharts.properties.DataAxisProperties类的典型用法代码示例。如果您正苦于以下问题:Java DataAxisProperties类的具体用法?Java DataAxisProperties怎么用?Java DataAxisProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataAxisProperties类属于org.jCharts.properties包,在下文中一共展示了DataAxisProperties类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: lineChart
import org.jCharts.properties.DataAxisProperties; //导入依赖的package包/类
public void lineChart(
int width,
int height,
String xAxisTitle,
String yAxisTitle,
String[] xAxisLabels,
String title,
String[] legendLabels,
double[][] data,
long yAxisMinValue,
long yAxisIncrement,
String filename) throws Exception {
LegendProperties legendProperties = new LegendProperties();
ChartProperties chartProperties = new ChartProperties();
AxisProperties axisProperties = new AxisProperties(false);
ChartFont axisScaleFont = new ChartFont(new Font("Georgia Negreta cursiva", Font.PLAIN, 10), Color.black);
axisProperties.setXAxisLabelsAreVertical(true);
axisProperties.getXAxisProperties().setScaleChartFont(axisScaleFont);
axisProperties.getYAxisProperties().setScaleChartFont(axisScaleFont);
ChartFont axisTitleFont = new ChartFont(new Font("Georgia Negreta cursiva", Font.PLAIN, 12), Color.black);
axisProperties.getXAxisProperties().setAxisTitleChartFont(axisTitleFont);
axisProperties.getYAxisProperties().setAxisTitleChartFont(axisTitleFont);
// If yAxisIncrement <= 0, then org.jCharts.properties.DataAxisProperties.setUserDefinedScale will throw a
// org.jCharts.properties.PropertyException ("The Axis Increment can not be a negative value or zero.").
if (yAxisMinValue != -1 && yAxisIncrement > 0) {
DataAxisProperties dataAxisProperties = (DataAxisProperties) axisProperties.getYAxisProperties();
dataAxisProperties.setUserDefinedScale(yAxisMinValue, yAxisIncrement);
}
ChartFont titleFont = new ChartFont(new Font("Georgia Negreta cursiva", Font.PLAIN, 14), Color.black);
chartProperties.setTitleFont(titleFont);
this.showGrid(axisProperties);
ValueLabelRenderer valueLabelRenderer = new ValueLabelRenderer(false, false, true, -1);
valueLabelRenderer.setValueLabelPosition(ValueLabelPosition.ON_TOP);
valueLabelRenderer.useVerticalLabels(false);
Stroke[] strokes = { LineChartProperties.DEFAULT_LINE_STROKE };
Shape[] shapes = { PointChartProperties.SHAPE_DIAMOND };
LineChartProperties lineChartProperties = new LineChartProperties(strokes, shapes);
IAxisDataSeries dataSeries = new DataSeries(xAxisLabels, xAxisTitle, yAxisTitle, title);
Paint[] color = new Paint[] { Color.BLUE };
dataSeries.addIAxisPlotDataSet(
new AxisChartDataSet(data, legendLabels, color, ChartType.LINE, lineChartProperties));
AxisChart axisChart = new AxisChart(dataSeries, chartProperties, axisProperties, legendProperties, width, height);
JPEGEncoder.encode(axisChart, 1.0f, new FileOutputStream(filename));
}
开发者ID:anwfr,项目名称:SvnStat,代码行数:57,代码来源:Graph.java
示例2: drawSample
import org.jCharts.properties.DataAxisProperties; //导入依赖的package包/类
private void drawSample(String _title, String[] _xAxisLabels, String _xAxisTitle,
String _yAxisTitle, double[][] _data, int _width, int _height, Graphics g) {
try {
if (_width == 0) {
_width = 450;
}
if (_height == 0) {
_height = 250;
}
this.setPreferredSize(new Dimension(_width,_height));
DataSeries dataSeries = new DataSeries( _xAxisLabels, _xAxisTitle, _yAxisTitle, _title );
String[] legendLabels= yAxisLabel;
Paint[] paints = this.createPaint(_data.length);
Shape[] shapes = createShapes(_data.length);
Stroke[] lstrokes = createStrokes(_data.length);
LineChartProperties lineChartProperties= new LineChartProperties(lstrokes,shapes);
AxisChartDataSet axisChartDataSet= new AxisChartDataSet( _data,
legendLabels,
paints,
ChartType.LINE,
lineChartProperties );
dataSeries.addIAxisPlotDataSet( axisChartDataSet );
ChartProperties chartProperties = new ChartProperties();
AxisProperties axisProperties = new AxisProperties();
// show the grid lines, to turn it off, set it to zero
axisProperties.getYAxisProperties().setShowGridLines(1);
axisProperties.setXAxisLabelsAreVertical(true);
// set the Y Axis to round
DataAxisProperties daxp = (DataAxisProperties)axisProperties.getYAxisProperties();
daxp.setRoundToNearest(1);
LegendProperties legendProperties = new LegendProperties();
AxisChart axisChart = new AxisChart(
dataSeries, chartProperties, axisProperties,
legendProperties, _width, _height );
axisChart.setGraphics2D((Graphics2D) g);
axisChart.render();
} catch (Exception e) {
log.error(e.getMessage());
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:42,代码来源:LineGraph.java
注:本文中的org.jCharts.properties.DataAxisProperties类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论