本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setDescription方法的具体用法?Java LineChart.setDescription怎么用?Java LineChart.setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_device, container, false);
mXAxis = (TextView) layout.findViewById(R.id.tvXAxis);
mYAxis = (TextView) layout.findViewById(R.id.tvYAxis);
mZAxis = (TextView) layout.findViewById(R.id.tvZAxis);
mMax = (TextView) layout.findViewById(R.id.tvMax);
mStart = (Button) layout.findViewById(R.id.bStart);
mStop = (Button) layout.findViewById(R.id.bStop);
mExport = (Button) layout.findViewById(R.id.bExport);
mChart = (LineChart) layout.findViewById(R.id.chart);
mChart.setDescription(null);
mChart.setHighlightPerDragEnabled(false);
mChart.setHighlightPerTapEnabled(false);
mChart.setPinchZoom(true);
mChart.getLegend().setDrawInside(true);
mChart.setExtraTopOffset(10);
mStart.setOnClickListener(this);
mStop.setOnClickListener(this);
mExport.setOnClickListener(this);
return layout;
}
示例2: initInValidGoNoGoGameLineChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initInValidGoNoGoGameLineChart(Activity activity, View view) {
inValidGoNoGoGamesLineChart = (LineChart) view.findViewById(R.id.line_chart_invalid_gonogogames);
inValidGoNoGoGamesLineChart.setDescription("");
String noData = activity.getResources().getString(R.string.no_failures_to_display);
inValidGoNoGoGamesLineChart.setNoDataText(noData);
inValidGoNoGoGamesLineChart.setTouchEnabled(false);
inValidGoNoGoGamesLineChart.setDragEnabled(true);
inValidGoNoGoGamesLineChart.setScaleEnabled(true);
inValidGoNoGoGamesLineChart.setPinchZoom(true);
inValidGoNoGoGamesLineChart.setBackgroundColor(Color.WHITE);
inValidGoNoGoGamesLineChart.setDrawGridBackground(false);
YAxis leftAxis = inValidGoNoGoGamesLineChart.getAxisLeft();
leftAxis.setAxisMinValue(0);
YAxis righAxis = inValidGoNoGoGamesLineChart.getAxisRight();
if (righAxis != null)
righAxis.setEnabled(false);
}
示例3: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
mChart.setDescription("");
// add an empty data object
mChart.setData(new LineData());
// mChart.getXAxis().setDrawLabels(false);
// mChart.getXAxis().setDrawGridLines(false);
mChart.invalidate();
}
示例4: chartStyling
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void chartStyling(LineChart chart) {
chart.setTouchEnabled(false);
chart.setDescription("");
chart.setAutoScaleMinMaxEnabled(false);
chart.setNoDataTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ? Color.BLACK : Color.WHITE);
YAxis axisRight = chart.getAxisRight();
axisRight.setEnabled(false);
chart.getLegend().setEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
chart.setNestedScrollingEnabled(false);
}
XAxis xAxis = chart.getXAxis();
chartXAxisStyling(xAxis);
YAxis yAxis = chart.getAxisLeft();
chartYAxisStyling(yAxis);
}
示例5: buildView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
this.fragmentManager = fragmentManager;
LineChart chart = new LineChart(context);
chart.setDescription(getDescription(context));
chart.setHighlightEnabled(true);
chart.setTouchEnabled(true);
chart.setDragDecelerationFrictionCoef(0.9f);
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
chart.setDrawGridBackground(false);
chart.setHighlightPerDragEnabled(true);
chart.setPinchZoom(true);
chart.animateX(2500);
chart.animateY(2500);
viewGroup.addView(chart);
return chart;
}
示例6: init
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void init(){
inflate(getContext(), R.layout.view_chart, this);
mToolbar = (Toolbar) findViewById(R.id.chart_toolbar);
mLineChart = (LineChart) findViewById(R.id.chart);
mToolbar.inflateMenu(R.menu.chart);
mToolbar.setOnMenuItemClickListener(this);
mLineChart.getLegend().setEnabled(false);
mLineChart.getXAxis().setDrawLabels(false);
mLineChart.getAxisLeft().setDrawLabels(true);
mLineChart.getAxisRight().setDrawLabels(false);
mLineChart.setDescription("");
mLineChart.setPinchZoom(false);
mLineChart.setDoubleTapToZoomEnabled(false);
}
示例7: styleGraph
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void styleGraph(LineChart lineChart) {
lineChart.setDescription("");
lineChart.getLegend().setEnabled(false);
XAxis xAxis = lineChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
lineChart.getAxisRight().setEnabled(false);
YAxis yAxis = lineChart.getAxisLeft();
yAxis.setValueFormatter(new ValueFormatter() {
@Override
public String getFormattedValue(float v) {
return yLabelsFormat.format(v) + " " + (char) 0x00B0 + "C";
}
});
yAxis.setStartAtZero(false);
}
示例8: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.v(TAG, "onCreateView() chart fragment");
// Load the layout of this fragment
View rootView = inflater.inflate(R.layout.fragment_chart, container, false);
createDataSets();
mChart = (LineChart) rootView.findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawYValues(false);
mChart.setDrawGridBackground(false);
mChart.setDescription("Battery and CPU usage chart");
mChart.setYRange(0, 100, false);
mChart.setDrawLegend(true);
initChart();
mChart.invalidate(); // invalidates the whole view
return rootView;
}
示例9: initTemperatureChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initTemperatureChart(LineChart mChart) {
// mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("Skin Temperature");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
mChart.setTouchEnabled(true);
mChart.setDragDecelerationFrictionCoef(0.9f);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setDrawGridBackground(false);
mChart.setHighlightPerDragEnabled(true);
mChart.setPinchZoom(true);
mChart.setBackgroundColor(getResources().getColor(R.color.blue_light_pressed));
mChart.animateX(2500);
Legend l = mChart.getLegend();
l.setForm(Legend.LegendForm.LINE);
l.setTypeface(BandApplication.INSTANCE.getTfLight());
l.setTextSize(11f);
l.setTextColor(Color.WHITE);
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
mChart.getXAxis().setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
leftAxis.setTextColor(Color.RED);
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
rightAxis.setTextColor(Color.RED);
rightAxis.setDrawGridLines(false);
rightAxis.setDrawZeroLine(false);
rightAxis.setGranularityEnabled(false);
}
示例10: initResistanceChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initResistanceChart(LineChart mChart) {
// mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("Skin Resistance");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
mChart.setTouchEnabled(true);
mChart.setDragDecelerationFrictionCoef(0.9f);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setDrawGridBackground(false);
mChart.setHighlightPerDragEnabled(true);
mChart.setPinchZoom(true);
mChart.setBackgroundColor(getResources().getColor(R.color.green_pressed));
mChart.animateX(2500);
Legend l = mChart.getLegend();
l.setForm(Legend.LegendForm.LINE);
l.setTypeface(BandApplication.INSTANCE.getTfLight());
l.setTextSize(11f);
l.setTextColor(Color.WHITE);
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
mChart.getXAxis().setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
leftAxis.setTextColor(Color.RED);
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
rightAxis.setTextColor(Color.RED);
rightAxis.setDrawGridLines(false);
rightAxis.setDrawZeroLine(false);
rightAxis.setGranularityEnabled(false);
}
示例11: ChartViewHolder
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
public ChartViewHolder(View itemView) {
super(itemView);
mChart = (LineChart) itemView.findViewById(R.id.chart);
mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
mChart.getAxisRight().setEnabled(false);
mChart.setTouchEnabled(false);
mChart.setDoubleTapToZoomEnabled(false);
mChart.setPinchZoom(false);
mChart.setDescription("");
}
示例12: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_performance_linechart);
mTvCount = (TextView) findViewById(R.id.tvValueCount);
mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
mTvCount.setText("500");
mSeekBarValues.setProgress(500);
mSeekBarValues.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setDrawGridBackground(false);
// no description text
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getAxisRight().setEnabled(false);
mChart.getXAxis().setDrawGridLines(true);
mChart.getXAxis().setDrawAxisLine(false);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例13: getFormattedLineChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
* Formats a line chart in a standardized manner
* @param c App context
* @param chart LineChart to format
* @param listener Listener to attach to chart
* @param xLabels Labels to use for the x-axis
* @param valueFormatter True if large value formatter should be used
* @param skip Number of values to skip
* @param legend True if show legend, false if hide legend
* @return Formatted linechart
*/
public static LineChart getFormattedLineChart(Context c, LineChart chart, OnChartValueSelectedListener listener, List<String> xLabels, boolean valueFormatter, int skip, boolean legend) {
Legend cLegend = chart.getLegend();
cLegend.setEnabled(legend);
XAxis xAxis = chart.getXAxis();
xAxis.setGranularity(skip);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setValueFormatter(new XAxisLabelFormatter(xLabels));
YAxis yAxisRight = chart.getAxisRight();
yAxisRight.setEnabled(false);
YAxis yAxisLeft = chart.getAxisLeft();
if (valueFormatter) {
yAxisLeft.setValueFormatter(new LargeNumberAxisFormatter(c));
}
if (SettingsActivity.getTheme(c) == SettingsActivity.THEME_NOIR) {
int textColorNoir = ContextCompat.getColor(c, R.color.colorPrimaryTextNoir);
cLegend.setTextColor(textColorNoir);
xAxis.setTextColor(textColorNoir);
yAxisLeft.setTextColor(textColorNoir);
}
chart.setDoubleTapToZoomEnabled(false);
chart.setDescription(EMPTY_CHART_DESCRIPTION);
chart.setDragEnabled(true);
chart.setScaleYEnabled(false);
chart.setDrawGridBackground(false);
chart.setOnChartValueSelectedListener(listener);
return chart;
}
示例14: setupAltitudeChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupAltitudeChart(){
TextView textAltitude = new TextView(this);
textAltitude.setText("Altitude:");
textAltitude.setTextColor(getResources().getColor(R.color.hike_blue_grey));
mAltitudeChartContainer.addView(textAltitude);
if(mCoordinatesList!=null) {
int listSize = mCoordinatesList.size();
if (listSize > 0) {
mAltitudeChart = new LineChart(this);
List<Entry> entries = new ArrayList<>(listSize);
for (int i = 0; i < listSize; i++) {
entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
}
LineDataSet altitudePoints = new LineDataSet(entries, "Altitude during Hike");
mAltitudeChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
mAltitudeChart.setDescription("");
mAltitudeChart.animateX(3500);
mAltitudeChart.getAxisLeft().setEnabled(false);
mAltitudeChart.setTouchEnabled(false);
mAltitudeChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mAltitudeChart.setMinimumHeight(ALTITUDE_CHART_HEIGHT);
mAltitudeChartContainer.addView(mAltitudeChart);
mAltitudeChartContainer.setMinimumHeight(ALTITUDE_CHART_HEIGHT);
return;
}
}
//Else...
TextView noAltitude = new TextView(this);
noAltitude.setText("No Altitude Height to Show");
mAltitudeChartContainer.addView(noAltitude);
}
示例15: setupInstPaceChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupInstPaceChart(){
TextView textInstPace = new TextView(this);
textInstPace.setText("Pace:");
textInstPace.setTextColor(getResources().getColor(R.color.hike_blue_grey));
mInstPaceChartContainer.addView(textInstPace);
if(mCoordinatesList!=null) {
int listSize = mCoordinatesList.size();
if (listSize > 0) {
mInstPaceChart = new LineChart(this);
List<Entry> entries = new ArrayList<>(listSize);
for (int i = 0; i < listSize; i++) {
//TODO change logic to get the instant pace instead of altidude
entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
}
LineDataSet altitudePoints = new LineDataSet(entries, "Pace during Hike");
mInstPaceChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
mInstPaceChart.setDescription("");
mInstPaceChart.animateX(3500);
mInstPaceChart.getAxisLeft().setEnabled(false);
mInstPaceChart.setTouchEnabled(false);
mInstPaceChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mInstPaceChart.setMinimumHeight(INST_PACE_CHART_HEIGHT);
mInstPaceChartContainer.addView(mInstPaceChart);
mInstPaceChartContainer.setMinimumHeight(INST_PACE_CHART_HEIGHT);
return;
}
//Else...
TextView noInstaPace = new TextView(this);
noInstaPace.setText("No Pace to Show");
mAltitudeChartContainer.addView(noInstaPace);
}
}