本文整理汇总了Java中com.github.mikephil.charting.components.YAxis.setDrawLimitLinesBehindData方法的典型用法代码示例。如果您正苦于以下问题:Java YAxis.setDrawLimitLinesBehindData方法的具体用法?Java YAxis.setDrawLimitLinesBehindData怎么用?Java YAxis.setDrawLimitLinesBehindData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.components.YAxis
的用法示例。
在下文中一共展示了YAxis.setDrawLimitLinesBehindData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Initialize the non-data aspects of the line chart
*/
private void initChart(){
//Initial line Chart for visualization of statistic
lineChart = (LineChart) findViewById(R.id.LineChart);
lineChart.setDragEnabled(true);
lineChart.setScaleEnabled(false);
lineChart.getAxisRight().setEnabled(false);
lineChart.getDescription().setEnabled(false);
YAxis leftAxis = lineChart.getAxisLeft();
leftAxis.removeAllLimitLines();
leftAxis.setAxisMaximum(100f);
leftAxis.setAxisMinimum(0.0f);
leftAxis.enableGridDashedLine(10f, 10f, 0f);
leftAxis.setDrawLimitLinesBehindData(true);
}
示例2: init
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
getDescription().setEnabled(false);
LimitLine llXAxis = new LimitLine(10f, "Index 10");
llXAxis.setLineWidth(4f);
llXAxis.enableDashedLine(10f, 10f, 0f);
llXAxis.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
llXAxis.setTextSize(10f);
XAxis xAxis = getXAxis();
// xAxis.enableGridDashedLine(10f, 10f, 0f);
xAxis.setDrawGridLines(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextColor(Color.GRAY);
LimitLine ll1 = new LimitLine(80f, "Avg");
ll1.setLineWidth(1f);
ll1.enableDashedLine(10f, 10f, 0f);
ll1.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
ll1.setTextSize(10f);
YAxis leftAxis = getAxisLeft();
leftAxis.removeAllLimitLines();
leftAxis.addLimitLine(ll1);
leftAxis.setAxisMaximum(160f);
leftAxis.setAxisMinimum(0f);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setTextColor(Color.GRAY);
leftAxis.setDrawLimitLinesBehindData(true);
getAxisRight().setEnabled(false);
Legend l = getLegend();
l.setForm(Legend.LegendForm.LINE);
}
示例3: updateLastScanChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public void updateLastScanChart() {
SharedPreferences sharedPrefs = PreferenceManager
.getDefaultSharedPreferences(this.getApplicationContext());
ImageView iv_unit;
iv_unit = (ImageView)findViewById(R.id.iv_unit);
if(sharedPrefs.getString("pref_unit", "mg/dl").equals("mg/dl")) {
iv_unit.setImageResource(R.drawable.unit_mgdl);
}else{
iv_unit.setImageResource(R.drawable.unit_mmoll);
}
LineChart cv_LastScan = (LineChart) findViewById(R.id.cv_LastScan);
if(sharedPrefs.getBoolean("pref_nightmode", false)) {
cv_LastScan.setBackgroundColor(getResources().getColor(R.color.colorBackgroundDark));
}else{
cv_LastScan.setBackgroundColor(getResources().getColor(R.color.colorBackgroundLight));
}
LineData getData = cv_LastScan.getData();
if(getData != null) {
YAxis yAxisLeft = cv_LastScan.getAxisLeft();
yAxisLeft.removeAllLimitLines();
yAxisLeft.setDrawLimitLinesBehindData(true);
yAxisLeft.resetAxisMaxValue();
if (cv_LastScan.getData() != null && !sharedPrefs.getString("pref_default_range", "0.0").equals("")) {
if (cv_LastScan.getData().getDataSets().get(0).getYMax() < Float.valueOf(sharedPrefs.getString("pref_default_range", "0.0"))) { //Todo: platz für highlight
yAxisLeft.setAxisMaxValue(Float.valueOf(sharedPrefs.getString("pref_default_range", "0.0")));
}
}
LimitLine ll_max = new LimitLine(Float.valueOf(sharedPrefs.getString("pref_zb_max", "-100.0")), getResources().getString(R.string.pref_zb_max));
ll_max.setLineWidth(4f);
ll_max.setTextSize(12f);
LimitLine ll_min = new LimitLine(Float.valueOf(sharedPrefs.getString("pref_zb_min", "-100.0")), getResources().getString(R.string.pref_zb_min));
ll_min.setLineWidth(4f);
ll_min.setTextSize(12f);
ll_min.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
Legend legend = cv_LastScan.getLegend();
legend.setEnabled(false);
// set an alternative background color
if (sharedPrefs.getBoolean("pref_nightmode", false)) {
ll_max.setLineColor(getResources().getColor(R.color.colorZielbereichDark));
ll_max.setTextColor(getResources().getColor(R.color.colorZielbereichDark));
ll_min.setLineColor(getResources().getColor(R.color.colorZielbereichDark));
ll_min.setTextColor(getResources().getColor(R.color.colorZielbereichDark));
} else {
ll_max.setLineColor(getResources().getColor(R.color.colorZielbereichLight));
ll_max.setTextColor(getResources().getColor(R.color.colorZielbereichLight));
ll_min.setLineColor(getResources().getColor(R.color.colorZielbereichLight));
ll_min.setTextColor(getResources().getColor(R.color.colorZielbereichLight));
}
yAxisLeft.addLimitLine(ll_max);
yAxisLeft.addLimitLine(ll_min);
cv_LastScan.notifyDataSetChanged();
cv_LastScan.invalidate();
}
}