use of org.xclcharts.renderer.axis.DataAxis in project XCL-Charts by xcltapestry.
the class MultiAxisChart01View method renderLnAxis.
/**
* 折线图轴相关
*/
private void renderLnAxis() {
//标签轴
lnChart.setCategories(chartLabelsLn);
//lnChart.getCategoryAxis().hide();
//设定数据源
lnChart.setDataSource(chartDatasetLn);
//数据轴
DataAxis dataAxis = lnChart.getDataAxis();
dataAxis.setHorizontalTickAlign(Align.RIGHT);
dataAxis.setAxisMax(135);
dataAxis.setAxisMin(0);
dataAxis.setAxisSteps(5);
dataAxis.getTickMarksPaint().setColor(Color.rgb(51, 204, 204));
dataAxis.getTickLabelPaint().setTextAlign(Align.LEFT);
dataAxis.getTickLabelPaint().setColor(Color.rgb(51, 204, 204));
//把折线图默认的顶上的轴线隐藏
//lnChart.hideTopAxis();
//定制数据轴上的标签格式
lnChart.getDataAxis().setLabelFormatter(new IFormatterTextCallBack() {
@Override
public String textFormatter(String value) {
// TODO Auto-generated method stub
double label = Double.parseDouble(value);
DecimalFormat df = new DecimalFormat("#0");
return df.format(label).toString();
}
});
}
use of org.xclcharts.renderer.axis.DataAxis in project XCL-Charts by xcltapestry.
the class MultiAxisChart02View method renderLnAxis.
/**
* 折线图轴相关
*/
private void renderLnAxis() {
//标签轴
lnChart.setCategories(chartLabelsLn);
lnChart.getCategoryAxis().hide();
//设定数据源
lnChart.setDataSource(chartDataLn);
//数据轴
lnChart.setDataAxisLocation(XEnum.AxisLocation.RIGHT);
DataAxis dataAxis = lnChart.getDataAxis();
dataAxis.setAxisMax(135);
dataAxis.setAxisMin(0);
dataAxis.setAxisSteps(15);
dataAxis.getAxisPaint().setColor(Color.rgb(51, 204, 204));
dataAxis.getTickMarksPaint().setColor(Color.rgb(51, 204, 204));
//定制数据轴上的标签格式
lnChart.getDataAxis().setLabelFormatter(new IFormatterTextCallBack() {
@Override
public String textFormatter(String value) {
// TODO Auto-generated method stub
double label = Double.parseDouble(value);
DecimalFormat df = new DecimalFormat("#0");
return df.format(label).toString();
}
});
//允许线与轴交叉时,线会断开
lnChart.setLineAxisIntersectVisible(false);
//调整右轴显示风格
lnChart.getDataAxis().setHorizontalTickAlign(Align.RIGHT);
lnChart.getDataAxis().getTickLabelPaint().setTextAlign(Align.LEFT);
lnChart.setXCoordFirstTickmarksBegin(true);
//
lnChart.setBarCenterStyle(XEnum.BarCenterStyle.SPACE);
}
Aggregations