use of org.xclcharts.chart.CustomLineData in project XCL-Charts by xcltapestry.
the class LineChart02View method chartDesireLines.
/**
* 期望线/分界线
*/
private void chartDesireLines() {
mCustomLineDataset.add(new CustomLineData("稍好", 1500d, Color.rgb(35, 172, 57), 5));
mCustomLineDataset.add(new CustomLineData("舒适", 3000d, Color.rgb(69, 181, 248), 5));
mCustomLineDataset.add(new CustomLineData("[个人均线]", calcAvg(), Color.rgb(251, 79, 128), 6));
}
use of org.xclcharts.chart.CustomLineData in project XCL-Charts by xcltapestry.
the class BarChart07View_left method chartDesireLines.
/**
* 期望线/分界线
*/
private void chartDesireLines() {
CustomLineData cl = new CustomLineData("适中", 18.5d, Color.rgb(77, 184, 73), 3);
cl.setLabelHorizontalPostion(Align.LEFT);
cl.hideLine();
mCustomLineDataset.add(cl);
}
use of org.xclcharts.chart.CustomLineData in project XCL-Charts by xcltapestry.
the class BarChart08View method chartDesireLines.
/**
* 期望线/分界线
*/
private void chartDesireLines() {
mCustomLineDataset.add(new CustomLineData("损失", -5d, Color.rgb(77, 184, 73), 3));
//mCustomLineDataset.add(new CustomLineData("超重",6d,(int)Color.rgb(252, 210, 9),4));
mCustomLineDataset.add(new CustomLineData("平衡", 10d, Color.rgb(171, 42, 96), 5));
mCustomLineDataset.add(new CustomLineData("良好", 15d, Color.RED, 6));
}
use of org.xclcharts.chart.CustomLineData in project XCL-Charts by xcltapestry.
the class BarChart10View method chartDesireLines.
/**
* 期望线/分界线
*/
private void chartDesireLines() {
CustomLineData s = new CustomLineData("", 0d, Color.BLUE, 3);
s.setLineStyle(XEnum.LineStyle.DOT);
mCustomLineDataset.add(s);
mCustomLineDataset.add(new CustomLineData("", 50d, Color.rgb(242, 242, 242), 3));
mCustomLineDataset.add(new CustomLineData("", 100d, Color.rgb(242, 242, 242), 6));
mCustomLineDataset.add(new CustomLineData("", 150d, Color.rgb(242, 242, 242), 3));
//mCustomLineDataset.add(new CustomLineData("200",200d,Color.BLACK,4));
//mCustomLineDataset.add(new CustomLineData("250",250d,Color.RED,5));
mCustomLineDataset.add(new CustomLineData("", 300d, Color.GREEN, 5));
}
use of org.xclcharts.chart.CustomLineData in project XCL-Charts by xcltapestry.
the class AreaChart02View method chartRender.
private void chartRender() {
try {
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int[] ltrb = getBarLnDefaultSpadding();
chart.setPadding(ltrb[0], ltrb[1], ltrb[2], ltrb[3]);
//轴数据源
//标签轴
chart.setCategories(mLabels);
//数据轴
chart.setDataSource(mDataset);
//仅横向平移
chart.setPlotPanMode(XEnum.PanMode.HORIZONTAL);
//数据轴最大值
chart.getDataAxis().setAxisMax(100);
//数据轴刻度间隔
chart.getDataAxis().setAxisSteps(10);
//网格
chart.getPlotGrid().showHorizontalLines();
chart.getPlotGrid().showVerticalLines();
//把顶轴和右轴隐藏
//chart.hideTopAxis();
//chart.hideRightAxis();
//把轴线和刻度线给隐藏起来
chart.getDataAxis().hideAxisLine();
chart.getDataAxis().hideTickMarks();
chart.getCategoryAxis().hideAxisLine();
chart.getCategoryAxis().hideTickMarks();
//标题
chart.setTitle("平滑区域图");
chart.addSubtitle("(XCL-Charts Demo)");
//轴标题
chart.getAxisTitle().setLowerTitle("(年份)");
//透明度
chart.setAreaAlpha(180);
//显示图例
chart.getPlotLegend().show();
//激活点击监听
chart.ActiveListenItemClick();
//为了让触发更灵敏,可以扩大5px的点击监听范围
chart.extPointClickRange(5);
//定义数据轴标签显示格式
chart.getDataAxis().setLabelFormatter(new IFormatterTextCallBack() {
@Override
public String textFormatter(String value) {
// TODO Auto-generated method stub
Double tmp = Double.parseDouble(value);
DecimalFormat df = new DecimalFormat("#0");
String label = df.format(tmp).toString();
return (label);
}
});
//设定交叉点标签显示格式
chart.setItemLabelFormatter(new IFormatterDoubleCallBack() {
@Override
public String doubleFormatter(Double value) {
// TODO Auto-generated method stub
DecimalFormat df = new DecimalFormat("#0");
String label = df.format(value).toString();
return label;
}
});
//扩大显示宽度
//chart.getPlotArea().extWidth(100f);
//chart.disablePanMode(); //test
CustomLineData line1 = new CustomLineData("标识线", 60d, Color.RED, 7);
line1.setCustomLineCap(XEnum.DotStyle.CROSS);
line1.setLabelHorizontalPostion(Align.CENTER);
line1.setLabelOffset(15);
line1.getLineLabelPaint().setColor(Color.RED);
mCustomLineDataset.add(line1);
chart.setCustomLines(mCustomLineDataset);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
Aggregations