本文整理汇总了Java中org.xclcharts.common.IFormatterTextCallBack类的典型用法代码示例。如果您正苦于以下问题:Java IFormatterTextCallBack类的具体用法?Java IFormatterTextCallBack怎么用?Java IFormatterTextCallBack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IFormatterTextCallBack类属于org.xclcharts.common包,在下文中一共展示了IFormatterTextCallBack类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderLnAxis
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
/**
* 折线图轴相关
*/
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();
}
});
}
示例2: chartRender
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
private void chartRender()
{
try {
//标题
chart.setTitle("柱形图左右移动演示");
chart.addSubtitle("(XCL-Charts Demo)");
chart.setTitleAlign(XEnum.HorizontalAlign.LEFT);
//数据源
chart.setDataSource(chartData);
chart.setCategories(chartLabels);
chart.setCustomLines(mCustomLineDataset);
//图例
chart.getAxisTitle().setLeftTitle("参考成年男性标准值");
//数据轴
chart.getDataAxis().setAxisMax(40);
chart.getDataAxis().setAxisMin(0);
chart.getDataAxis().setAxisSteps(5);
//指隔多少个轴刻度(即细刻度)后为主刻度
chart.getDataAxis().setDetailModeSteps(2);
//定义数据轴标签显示格式
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.getDataAxis().hideAxisLine();
//隐藏Key
chart.getPlotLegend().hide();
chart.getCategoryAxis().hide();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: chartRender
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
private void chartRender()
{
try {
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int [] ltrb = getBarLnDefaultSpadding();
chart.setPadding(ltrb[0] + DensityUtil.dip2px(this.getContext(), 10), ltrb[1],
ltrb[2]+DensityUtil.dip2px(this.getContext(), 20), ltrb[3]);
//标题
chart.setTitle("New GitHub repositories");
chart.addSubtitle("(XCL-Charts Demo)");
chart.getAxisTitle().setLeftTitle("Percentage (annual)");
chart.getAxisTitle().getLeftTitlePaint().setColor(Color.BLACK);
//显示边框
chart.showRoundBorder();
//数据源
chart.setCategories(labels);
chart.setDataSource(chartData);
chart.setCustomLines(mCustomLineDataset);
//坐标系
//数据轴最大值
chart.getDataAxis().setAxisMax(20);
//chart.getDataAxis().setAxisMin(0);
//数据轴刻度间隔
chart.getDataAxis().setAxisSteps(5);
//标签轴最大值
chart.setCategoryAxisMax(6);
//标签轴最小值
chart.setCategoryAxisMin(0);
//背景网格
PlotGrid plot = chart.getPlotGrid();
plot.hideHorizontalLines();
plot.hideVerticalLines();
chart.getDataAxis().getAxisPaint().setColor(Color.rgb(127, 204, 204));
chart.getCategoryAxis().getAxisPaint().setColor(Color.rgb(127, 204, 204));
chart.getDataAxis().getTickMarksPaint().setColor(Color.rgb(127, 204, 204));
chart.getCategoryAxis().getTickMarksPaint().setColor(Color.rgb(127, 204, 204));
//定义数据轴标签显示格式
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);
}
});
//不使用精确计算,忽略Java计算误差,提高性能
chart.disableHighPrecision();
chart.disablePanMode();
chart.hideBorder();
chart.getPlotLegend().hide();
//chart.getCategoryAxis().setLabelLineFeed(XEnum.LabelLineFeed.ODD_EVEN);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
示例4: renderLnAxis
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
/**
* 折线图轴相关
*/
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);
}
示例5: chartBgRender
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
private void chartBgRender()
{
try{
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int [] ltrb = getBarLnDefaultSpadding();
chartBg.setPadding(ltrb[0], ltrb[1], ltrb[2], ltrb[3]);
chartBg.disableHighPrecision();
chartBg.disablePanMode();
//轴数据源
//标签轴
chartBg.setCategories(mBgLabels);
//数据轴
//chartBg.setDataSource(mDataset);
chartBg.setCrurveLineStyle(XEnum.CrurveLineStyle.BEELINE);
//数据轴最大值
chartBg.getDataAxis().setAxisMax(100);
//数据轴刻度间隔
chartBg.getDataAxis().setAxisSteps(10);
//网格
chartBg.getPlotGrid().showHorizontalLines();
chartBg.getPlotGrid().showVerticalLines();
chartBg.getPlotGrid().setHorizontalLineStyle(XEnum.LineStyle.DOT);
chartBg.getPlotGrid().setVerticalLineStyle(XEnum.LineStyle.DOT);
//把轴线和刻度线给隐藏起来
chartBg.getDataAxis().hideAxisLine();
chartBg.getDataAxis().hideTickMarks();
chartBg.getCategoryAxis().hideAxisLine();
chartBg.getCategoryAxis().hideTickMarks();
chartBg.getDataAxis().getTickLabelPaint().setColor(Color.GREEN);
//定义数据轴标签显示格式
chartBg.getDataAxis().setLabelFormatter(new IFormatterTextCallBack(){
@Override
public String textFormatter(String value) {
// TODO Auto-generated method stub
Double tmp = Double.parseDouble(value);
if(Double.compare(tmp, mStdValue) == -1 || Double.compare(tmp, mStdValue) == 0){
return "";
}else{
DecimalFormat df=new DecimalFormat("#0");
String label = df.format(tmp).toString();
return (label);
}
}
});
chartBg.getPlotLegend().hide();
//chart.disablePanMode();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
示例6: setDotLabelFormatter
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
/**
* 设置标签的显示格式
* @param callBack 回调函数
*/
public void setDotLabelFormatter(IFormatterTextCallBack callBack) {
this.mLabelFormatter = callBack;
}
示例7: setLabelFormatter
import org.xclcharts.common.IFormatterTextCallBack; //导入依赖的package包/类
/**
* 设置标签的显示格式
* @param callBack 回调函数
*/
public void setLabelFormatter(IFormatterTextCallBack callBack) {
this.mLabelFormatter = callBack;
}