本文整理汇总了Java中com.github.mikephil.charting.charts.CombinedChart.setDrawGridBackground方法的典型用法代码示例。如果您正苦于以下问题:Java CombinedChart.setDrawGridBackground方法的具体用法?Java CombinedChart.setDrawGridBackground怎么用?Java CombinedChart.setDrawGridBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.CombinedChart
的用法示例。
在下文中一共展示了CombinedChart.setDrawGridBackground方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareLegend
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
/**
* Create a legend based on a dummy chart. The legend
* is used by all charts and is positioned
* across the top of the screen.
* @param data - CombinedData used to generate the legend
*/
private void prepareLegend(final CombinedData data){
//The dummy chart is never shown, but it's legend is.
final CombinedChart dummyChart = (CombinedChart) mRoot.findViewById(R.id.legend);
dummyChart.getPaint(Chart.PAINT_DESCRIPTION).setTextAlign(Paint.Align.CENTER);
dummyChart.getXAxis().setEnabled(false);
dummyChart.getAxisRight().setEnabled(false);
dummyChart.getAxisLeft().setEnabled(false);
final Description description = new Description();
description.setText("");
description.setTextSize(10f);
dummyChart.setDescription(description);
dummyChart.setBackgroundColor(Color.WHITE);
dummyChart.setDrawGridBackground(false);
dummyChart.setData(data);
final Legend l = dummyChart.getLegend();
l.setEnabled(true);
// The positioning of the legend effectively
// hides the dummy chart from view.
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
dummyChart.invalidate();
}
示例2: onCreate
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);
mChart = (CombinedChart) findViewById(R.id.chart1);
mChart.setDescription("");
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
// draw bars behind lines
mChart.setDrawOrder(new DrawOrder[] {
DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
});
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTH_SIDED);
CombinedData data = new CombinedData(mMonths);
data.setData(generateLineData());
data.setData(generateBarData());
// data.setData(generateBubbleData());
// data.setData(generateScatterData());
// data.setData(generateCandleData());
mChart.setData(data);
mChart.invalidate();
}
示例3: prepareChartView
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
/**
* Build out the charts for given dataset
* @param id - int representing chart id
* @param data - CombinedData displayed in the chart
*/
private void prepareChartView(final int id, final CombinedData data){
final CombinedChart chart = (CombinedChart) mRoot.findViewById(id);
chart.getPaint(Chart.PAINT_DESCRIPTION).setTextAlign(Paint.Align.CENTER);
chart.getXAxis().setEnabled(false);
chart.getAxisRight().setEnabled(false);
chart.getAxisLeft().setDrawGridLines(false);
chart.getDescription().setEnabled(false);
chart.getLegend().setEnabled(false);
chart.setBackgroundColor(Color.WHITE);
chart.setDrawGridBackground(false);
chart.setData(data);
chart.invalidate();
}
示例4: onCreate
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);
mChart = (CombinedChart) findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setHighlightFullBarEnabled(false);
// draw bars behind lines
mChart.setDrawOrder(new DrawOrder[]{
DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
});
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTH_SIDED);
xAxis.setAxisMinimum(0f);
xAxis.setGranularity(1f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return mMonths[(int) value % mMonths.length];
}
});
CombinedData data = new CombinedData();
data.setData(generateLineData());
data.setData(generateBarData());
data.setData(generateBubbleData());
data.setData(generateScatterData());
data.setData(generateCandleData());
data.setValueTypeface(mTfLight);
xAxis.setAxisMaximum(data.getXMax() + 0.25f);
mChart.setData(data);
mChart.invalidate();
}
示例5: onCreate
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mChart = (CombinedChart) findViewById(R.id.chart1);
//描述
mChart.getDescription().setEnabled(false);
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setHighlightFullBarEnabled(false);
mChart.setScaleEnabled(false);
mChart.setScaleYEnabled(false);
mChart.setScaleXEnabled(false);
mChart.setPinchZoom(false);
// mChart.setScaleMinima(2f, 1f);
// mChart.setAutoScaleMinMaxEnabled(true);
// draw bars behind lines
mChart.setDrawOrder(new CombinedChart.DrawOrder[]{
CombinedChart.DrawOrder.BAR
});
//图例
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
rightAxis.setAxisMinimum(0f);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setEnabled(false);
leftAxis.setAxisMinimum(0f);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
// xAxis.setAvoidFirstLastClipping(true);
xAxis.setAxisMinimum(0.5f);
xAxis.setGranularity(1f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
if (value % 1 == 0&&value>=1) {
return mMonths[(int) value % mMonths.length-1];
} else {
return "";
}
}
});
CombinedData data = new CombinedData();
data.setData(generateBarData(1f, 1f));
xAxis.setAxisMaximum(data.getXMax() + 0.25f);
mChart.setData(data);
mChart.setVisibleXRange(3, 5);
mChart.setExtraOffsets(10, 0, 0, 0);
mChart.invalidate();
}
示例6: onCreate
import com.github.mikephil.charting.charts.CombinedChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mChart = (CombinedChart) findViewById(R.id.chart1);
//描述
mChart.getDescription().setEnabled(false);
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setHighlightFullBarEnabled(false);
mChart.setScaleEnabled(false);
mChart.setScaleYEnabled(false);
mChart.setScaleXEnabled(false);
mChart.setPinchZoom(false);
// mChart.setScaleMinima(2f, 1f);
// mChart.setAutoScaleMinMaxEnabled(true);
// draw bars behind lines
mChart.setDrawOrder(new CombinedChart.DrawOrder[]{
CombinedChart.DrawOrder.BAR
});
//图例
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
rightAxis.setAxisMinimum(0f);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setEnabled(false);
leftAxis.setAxisMinimum(0f);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
// xAxis.setAvoidFirstLastClipping(true);
xAxis.setAxisMinimum(0.5f);
xAxis.setGranularity(1f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
if (value % 1 == 0&&value>=1) {
return mMonths[(int) value % mMonths.length-1];
} else {
return "";
}
}
});
CombinedData data = new CombinedData();
data.setData(generateBarData(1f, 1f));
xAxis.setAxisMaximum(data.getXMax() + 0.25f);
mChart.setData(data);
mChart.setVisibleXRange(4, 6);
mChart.setExtraOffsets(10, 0, 0, 0);
mChart.invalidate();
}