本文整理汇总了Java中com.github.mikephil.charting.charts.BarChart.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java BarChart.setDescription方法的具体用法?Java BarChart.setDescription怎么用?Java BarChart.setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.BarChart
的用法示例。
在下文中一共展示了BarChart.setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//return buildChart();
mLayout = (LinearLayout) inflater.inflate(R.layout.chart_bar_fragment, container, false);
mChart = (BarChart) mLayout.findViewById(R.id.chartBar);
mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("");
// mChart.setDrawBorders(true);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
return mLayout;
}
示例2: onCreateView
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_idpt, container, false);
BarChart chart = (BarChart) view.findViewById(R.id.chart);
BarData data = new BarData(getXAxisValues(), getDataSet());
//legend coding
Legend l=chart.getLegend();
l.setFormSize(10f);
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
l.setTextSize(12f);
l.setTextColor(Color.BLACK);
l.setXEntrySpace(5f);
l.setYEntrySpace(5f);
//l.setCustom();
XAxis xaxis=chart.getXAxis();
xaxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xaxis.setTextSize(7f);
xaxis.setTextColor(Color.parseColor("#212121"));
xaxis.setDrawAxisLine(true);
xaxis.setDrawGridLines(false);
chart.setData(data);
chart.setDescription("");
chart.animateXY(2000, 2000);
chart.invalidate();
// chart.zoom(100, 10, 10, 10);
return view;
}
示例3: onCreateView
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
// create a new chart object
mChart = new BarChart(getActivity());
mChart.setDescription("");
mChart.setOnChartGestureListener(this);
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mChart.setMarkerView(mv);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
mChart.setData(generateBarData(1, 20000, 12));
Legend l = mChart.getLegend();
l.setTypeface(tf);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(tf);
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
// programatically add the chart
FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
parent.addView(mChart);
return v;
}
示例4: onCreate
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_scrollview);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDescription("");
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setLabelsToSkip(0);
xAxis.setDrawGridLines(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getLegend().setEnabled(false);
setData(10);
}
示例5: onCreate
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chart);
BarChart chart = (BarChart) findViewById(R.id.chart);
//BarData data = new BarData(getXAxisValues(),getDataSet());
BarData data = new BarData();
chart.setData(data);
chart.setDescription("My Chart");
chart.animateXY(2000, 2000);
chart.invalidate();
}
示例6: initChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
/**
* initiliaze chart
*/
private void initChart() {
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
mChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setDescriptionColor(Color.parseColor("#000000"));
XAxis xAxis = mChart.getXAxis();
xAxis.setDrawGridLines(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setSpaceBetweenLabels(0);
YAxisValueFormatter custom = new DataAxisFormatter("%");
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setValueFormatter(custom);
rightAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setDrawGridLines(true);
rightAxis.setDrawGridLines(false);
mChart.animateY(1000);
mChart.getLegend().setEnabled(true);
mChart.setVisibility(View.GONE);
}
示例7: initChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initChart(BarChart chart) {
float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
chart.setDragEnabled(true);
chart.setScaleYEnabled(false);
chart.setScaleXEnabled(false);
chart.setDoubleTapToZoomEnabled(false);
chart.setPinchZoom(false);
chart.setHighlightPerDragEnabled(false);
chart.setHighlightPerTapEnabled(false);
chart.setDrawGridBackground(false);
chart.setDrawBorders(false);
chart.setDrawValueAboveBar(false);
chart.getAxisLeft().setEnabled(false);
XAxis xAxis = chart.getXAxis();
xAxis.setDrawAxisLine(true);
xAxis.setDrawGridLines(false);
xAxis.setDrawLabels(false);
xAxis.setDrawLimitLinesBehindData(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
YAxis yAxis = chart.getAxisRight();
yAxis.setDrawAxisLine(false);
yAxis.setStartAtZero(false);
yAxis.setSpaceTop(10f);
yAxis.setSpaceBottom(0f);
yAxis.setTextSize(10 * scaledDensity);
yAxis.setTextColor(ContextCompat.getColor(this, R.color.text));
chart.getLegend().setEnabled(false);
chart.setDescription(" ");
chart.setNoDataText("Can't see sh*t captain!");
Paint p = chart.getPaint(Chart.PAINT_INFO);
DisplayMetrics dm = getResources().getDisplayMetrics();
int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, dm); //TODO use styles
p.setTextSize(size);
p.setColor(ContextCompat.getColor(this, R.color.gray600));
p.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
示例8: onCreate
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
barChart = (BarChart)findViewById(R.id.chart);
ArrayList<BarEntry> entries = new ArrayList<>();
entries.add(new BarEntry(4f, 0));
entries.add(new BarEntry(8f, 1));
entries.add(new BarEntry(6f, 2));
entries.add(new BarEntry(12f, 3));
entries.add(new BarEntry(18f, 4));
entries.add(new BarEntry(9f, 5));
BarDataSet dataset = new BarDataSet(entries, "# of Calls");
//Add this to set the color
// dataset.setColors(ColorTemplate.COLORFUL_COLORS);
ArrayList<String> labels = new ArrayList<String>();
labels.add("January");
labels.add("February");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
data = new BarData(labels,dataset);
barChart.setData(data);
barChart.setDescription("Bar Chart Desc");
}
示例9: setupTemperatureChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
protected void setupTemperatureChart(){
EnvStatistic temperature = mHDD.getSessionData().getCurrentStats().getTemperature();
if(temperature!=null && temperature.isValid()){
mTempChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) temperature.getMin(), 0));
statVals.add(new BarEntry((float) temperature.getAvg(), 1));
statVals.add(new BarEntry((float) temperature.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Temperature");
mTempChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mTempChart.setDescription("");
mTempChart.animateY(2000);
mTempChart.getAxisRight().setEnabled(false);
mTempChart.setTouchEnabled(false);
mTempChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mTempChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mTempChartContainer.addView(mTempChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Temperature Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mTempChartContainer.addView(noGraph);
}
}
示例10: setupPressureChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
protected void setupPressureChart(){
EnvStatistic pressure = mHDD.getSessionData().getCurrentStats().getPressure();
if(pressure!=null && pressure.isValid()){
mPressureChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) pressure.getMin(),0));
statVals.add(new BarEntry((float) pressure.getAvg(), 1));
statVals.add(new BarEntry((float) pressure.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Pressure");
mPressureChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mPressureChart.setDescription("");
mPressureChart.animateY(2000);
mPressureChart.getAxisRight().setEnabled(false);
mPressureChart.setTouchEnabled(false);
mPressureChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mPressureChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mPressureChartContainer.addView(mPressureChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Pressure Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mPressureChartContainer.addView(noGraph);
}
}
示例11: setupHumidityChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
protected void setupHumidityChart(){
EnvStatistic humidity = mHDD.getSessionData().getCurrentStats().getHumidity();
if(humidity!=null && humidity.isValid()){
mHumidityChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) humidity.getMin(), 0));
statVals.add(new BarEntry((float) humidity.getAvg(), 1));
statVals.add(new BarEntry((float) humidity.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Humidity");
mHumidityChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mHumidityChart.setDescription("");
mHumidityChart.animateY(2000);
mHumidityChart.getAxisRight().setEnabled(false);
mHumidityChart.setTouchEnabled(false);
mHumidityChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mHumidityChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mHumidityChartContainer.addView(mHumidityChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Humidity Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mHumidityChartContainer.addView(noGraph);
}
}
示例12: createGraph
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void createGraph() {
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDescription("");
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
}
示例13: initChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initChart() {
barChart = (BarChart)findViewById(R.id.chart);
barChart.setBorderColor(getResources().getColor(R.color.primary_dark));
barChart.setDrawBarShadow(false);
barChart.setDrawValueAboveBar(true);
barChart.setDescription("Operations/second");
barChart.setMaxVisibleValueCount(20);
barChart.setPinchZoom(false);
barChart.setDrawGridBackground(false);
XAxis xl = barChart.getXAxis();
xl.setPosition(XAxis.XAxisPosition.BOTTOM);
xl.setDrawAxisLine(true);
xl.setDrawGridLines(true);
xl.setGridLineWidth(0.3f);
YAxis yl = barChart.getAxisLeft();
yl.setDrawAxisLine(true);
yl.setDrawGridLines(true);
yl.setGridLineWidth(0.3f);
YAxis yr = barChart.getAxisRight();
yr.setDrawAxisLine(true);
yr.setDrawGridLines(false);
Legend l = barChart.getLegend();
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
l.setFormSize(8f);
l.setXEntrySpace(4f);
}
示例14: initBar
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initBar() {
BarChart barChart = getBarChart();
if(barChart == null) {
return;
}
barChart.setDescription("");
barChart.setDrawGridBackground(false);
barChart.setMaxVisibleValueCount(200);
Legend l = barChart.getLegend();
l.setPosition(Legend.LegendPosition.ABOVE_CHART_LEFT);
l.setTextColor(Color.WHITE);
YAxis yl = barChart.getAxisLeft();
yl.setTextColor(Color.WHITE);
yl.setGridColor(Color.WHITE);
barChart.getAxisRight().setEnabled(false);
XAxis xl = barChart.getXAxis();
xl.setDrawGridLines(false);
xl.setTextColor(Color.WHITE);
xl.setGridColor(Color.WHITE);
xl.setPosition(XAxis.XAxisPosition.BOTTOM);
xl.setDrawAxisLine(true);
xl.setLabelRotationAngle(-90);
xl.setDrawLabels(true);
xl.setLabelsToSkip(0);
}
示例15: initCharts
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initCharts(BarChart mChart) {
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
mChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// mChart.setDrawBarShadow(true);
// mChart.setDrawXLabels(false);
mChart.setDrawGridBackground(false);
// mChart.setDrawYLabels(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
leftAxis.setLabelCount(6, false);
// leftAxis.setAxisMinimum(-2.5f);
// leftAxis.setAxisMaximum(2.5f);
leftAxis.setGranularityEnabled(true);
leftAxis.setGranularity(0.1f);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
rightAxis.setLabelCount(6, false);
// rightAxis.setAxisMinimum(-2.5f);
// rightAxis.setAxisMaximum(2.5f);
rightAxis.setGranularity(0.1f);
Legend l = mChart.getLegend();
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
l.setForm(Legend.LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
mChart.animateXY(2000, 2000);
}