本文整理汇总了Java中com.github.mikephil.charting.charts.BarChart.setMaxVisibleValueCount方法的典型用法代码示例。如果您正苦于以下问题:Java BarChart.setMaxVisibleValueCount方法的具体用法?Java BarChart.setMaxVisibleValueCount怎么用?Java BarChart.setMaxVisibleValueCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.BarChart
的用法示例。
在下文中一共展示了BarChart.setMaxVisibleValueCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: buildChart
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
protected Chart buildChart(Context context) {
BarChart chart = new BarChart(context);
chart.setDrawBarShadow(true);
chart.setDrawValueAboveBar(true);
chart.setMaxVisibleValueCount(60);
chart.setPinchZoom(true);
return chart;
}
示例3: buildView
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
BarChart chart = new BarChart(context);
chart.setDrawBarShadow(true);
chart.setDrawValueAboveBar(true);
chart.setMaxVisibleValueCount(60);
chart.setPinchZoom(true);
return chart;
}
示例4: 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);
}
示例5: 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);
}
示例6: 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_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(40);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(false);
mChart.setHighlightFullBarEnabled(false);
// change the position of the y-labels
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(new MyAxisValueFormatter());
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);
XAxis xLabels = mChart.getXAxis();
xLabels.setPosition(XAxisPosition.TOP);
// mChart.setDrawXLabels(false);
// mChart.setDrawYLabels(false);
// setting data
mSeekBarX.setProgress(12);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setFormSize(8f);
l.setFormToTextSpace(4f);
l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
示例7: 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_barchart_sinus);
mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(), "othersine.txt");
tvX = (TextView) findViewById(R.id.tvValueCount);
mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
mChart.getDescription().setEnabled(false);
// 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(mTfLight);
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(mTfLight);
rightAxis.setLabelCount(6, false);
rightAxis.setAxisMinimum(-2.5f);
rightAxis.setAxisMaximum(2.5f);
rightAxis.setGranularity(0.1f);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarX.setProgress(150); // set data
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
mChart.animateXY(2000, 2000);
}
示例8: 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_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);
// 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.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
mChart.getAxisLeft().setDrawGridLines(false);
// setting data
mSeekBarX.setProgress(10);
mSeekBarY.setProgress(100);
// add a nice and smooth animation
mChart.animateY(2500);
mChart.getLegend().setEnabled(false);
}
示例9: 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);
}
示例10: 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_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
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.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(false);
// change the position of the y-labels
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(new MyYAxisValueFormatter());
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);
XAxis xLabels = mChart.getXAxis();
xLabels.setPosition(XAxisPosition.TOP);
// mChart.setDrawXLabels(false);
// mChart.setDrawYLabels(false);
// setting data
mSeekBarX.setProgress(12);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
l.setFormSize(8f);
l.setFormToTextSpace(4f);
l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
示例11: 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_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
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.setDrawYLabels(false);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTf);
xAxis.setDrawGridLines(false);
xAxis.setSpaceBetweenLabels(2);
YAxisValueFormatter custom = new MyYAxisValueFormatter();
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(8, false);
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setSpaceTop(15f);
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(8, false);
rightAxis.setValueFormatter(custom);
rightAxis.setSpaceTop(15f);
rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.BELOW_CHART_LEFT);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
// l.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
// "def", "ghj", "ikl", "mno" });
// l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
// "def", "ghj", "ikl", "mno" });
setData(12, 50);
// setting data
mSeekBarY.setProgress(50);
mSeekBarX.setProgress(12);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
// mChart.setDrawLegend(false);
}
示例12: 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_barchart_sinus);
mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(),"othersine.txt");
tvX = (TextView) findViewById(R.id.tvValueCount);
mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);
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);
// draw shadows for each bar that show the maximum value
// mChart.setDrawBarShadow(true);
// mChart.setDrawXLabels(false);
mChart.setDrawGridBackground(false);
// mChart.setDrawYLabels(false);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTf);
xAxis.setDrawGridLines(false);
xAxis.setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(6, false);
leftAxis.setAxisMinValue(-2.5f);
leftAxis.setAxisMaxValue(2.5f);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(6, false);
rightAxis.setAxisMinValue(-2.5f);
rightAxis.setAxisMaxValue(2.5f);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarX.setProgress(150); // set data
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.BELOW_CHART_LEFT);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
mChart.animateXY(2000, 2000);
}
示例13: 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_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
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.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setSpaceBetweenLabels(0);
xAxis.setDrawGridLines(false);
mChart.getAxisLeft().setDrawGridLines(false);
// setting data
mSeekBarX.setProgress(10);
mSeekBarY.setProgress(100);
// add a nice and smooth animation
mChart.animateY(2500);
mChart.getLegend().setEnabled(false);
// Legend l = mChart.getLegend();
// l.setPosition(LegendPosition.BELOW_CHART_CENTER);
// l.setFormSize(8f);
// l.setFormToTextSpace(4f);
// l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
示例14: onCreate
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scoreboard);
dbInit(getIntent());
sparkAddressMap = new HashMap<String, String>();
sparkAddressMap.put("BlackMage", "53ff70065075535143191087");
sparkAddressMap.put("WhiteMage", "50ff6e065067545631270587");
sparkAddressMap.put("GreenMage", "48ff70065067555028111587");
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setOnChartGestureListener(this);
mChart.setDrawValueAboveBar(true);
mChart.setDescription("");
// Dario flag changes
mChart.setDragEnabled(false);
mChart.setScaleEnabled(false);
// Set max on the chart to 10 for now, should never go above 3 on demo
mChart.setMaxVisibleValueCount(10);
// Scaling can now only be done on the x and y-axis separately
mChart.setPinchZoom(false);
// Disable background
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
intFormat = new MyValueFormatter();
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(intFormat);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
setData();
Legend l = mChart.getLegend();
l.setEnabled(false);
/*** Begin Repeating Alarm Setup ***/
int pollFrequencySeconds = 5;
Context context = getApplicationContext();
alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
intent.putExtra("myGlass", myGlass);
// Log.d(TAG, "Input to alarm: " + myGlass);
intent.putExtra("myAddr", sparkAddressMap.get(myGlass));
alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
1000 * pollFrequencySeconds,
1000 * pollFrequencySeconds,
alarmIntent);
Toast.makeText(this, "Alarm Set", Toast.LENGTH_SHORT).show();
/*** Begin UI Update Listener ***/
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
setDataFromJSON(intent.getStringExtra(PollGameStatusService.SCORE_KEY));
}
};
}
示例15: onCreateView
import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if(view == null) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_measurement_spectrum, container, false);
BarChart sChart = (BarChart) view.findViewById(R.id.spectrumChart);
sChart.setDrawBarShadow(false);
sChart.setDescription("");
sChart.getLegend().setEnabled(false);
sChart.setTouchEnabled(false);
sChart.setPinchZoom(false);
sChart.setDrawGridBackground(false);
sChart.setMaxVisibleValueCount(0);
sChart.setHorizontalScrollBarEnabled(false);
sChart.setVerticalScrollBarEnabled(false);
sChart.setNoDataTextDescription(getText(R.string.no_data_text_description).toString());
// XAxis parameters:
XAxis xls = sChart.getXAxis();
xls.setPosition(XAxis.XAxisPosition.BOTTOM);
xls.setDrawAxisLine(true);
xls.setDrawGridLines(false);
xls.setDrawLabels(true);
xls.setTextColor(Color.WHITE);
xls.setAvoidFirstLastClipping(false);
// YAxis parameters (left): main axis for dB values representation
YAxis yls = sChart.getAxisLeft();
yls.setDrawAxisLine(true);
yls.setDrawGridLines(true);
yls.setAxisMaxValue(100.f);
yls.setAxisMinValue(0f);
yls.setTextColor(Color.WHITE);
yls.setGridColor(Color.WHITE);
yls.setSpaceBottom(0);
yls.setSpaceTop(0);
yls.setValueFormatter(new SPLValueFormatter());
// YAxis parameters (right): no axis, hide all
YAxis yrs = sChart.getAxisRight();
yrs.setEnabled(false);
}
return view;
}