本文整理匯總了Java中com.github.mikephil.charting.data.LineDataSet.setHighlightEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java LineDataSet.setHighlightEnabled方法的具體用法?Java LineDataSet.setHighlightEnabled怎麽用?Java LineDataSet.setHighlightEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.setHighlightEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepareInitData
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet prepareInitData(@NonNull LineChart chart, @NonNull List<Entry> entries) {
final LineDataSet set = new LineDataSet(entries, "Accuracy");
set.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setLineWidth(2F);
set.setDrawCircleHole(false);
set.setDrawCircles(false);
set.setHighlightEnabled(false);
set.setDrawFilled(true);
final LineData group = new LineData(set);
group.setDrawValues(false);
chart.setData(group);
return set;
}
示例2: createDataSet
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
* Creates a data set with the given label and color. Highlights and drawing of values and
* circles are disabled, as that is common for many cases.
*
* @param label The label to assign to the new data set.
* @param color The line color to set for the new data set.
*/
private LineDataSet createDataSet(String label, int color) {
// A legend is enabled on the chart view in the graph fragment. The legend is created
// automatically, but requires a unique labels and colors on each data set.
final LineDataSet dataSet = new LineDataSet(null, label);
// A dashed line can make peaks inaccurate. It also makes the graph look too "busy". It
// is OK for some uses, such as progressions of best times, but that is left to the caller
// to change once this new data set is returned.
//
// If graphing only times for a session, there will be fewer, and a thicker line will look
// well. However, if all times are graphed, a thinner line will probably look better, as
// the finer details will be more visible.
dataSet.setLineWidth(getLineWidth());
dataSet.setColor(color);
dataSet.setHighlightEnabled(false);
dataSet.setDrawCircles(false);
dataSet.setDrawValues(false);
return dataSet;
}
示例3: generateLineData
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
* 曲線
*/
private LineData generateLineData() {
LineData lineData = new LineData();
ArrayList<Entry> entries = new ArrayList<>();
for (int index = 0; index < items.size(); index++) {
entries.add(new Entry(index + 1f, (float) items.get(index).sub_data.getData()));
}
LineDataSet lineDataSet = new LineDataSet(entries, "對比數據");
lineDataSet.setValues(entries);
lineDataSet.setDrawValues(false);//是否在線上顯示值
lineDataSet.setColor(ContextCompat.getColor(mContext, R.color.co3));
lineDataSet.setLineWidth(2.5f);
lineDataSet.setCircleColor(ContextCompat.getColor(mContext, R.color.co3));
lineDataSet.setCircleRadius(5f);
lineDataSet.setDrawCircles(false);
lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);//設置線條類型
//set.setDrawHorizontalHighlightIndicator(false);//隱藏選中線
//set.setDrawVerticalHighlightIndicator(false);//隱藏選中線條
lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
lineDataSet.setHighlightEnabled(false);
lineData.setHighlightEnabled(false);
lineData.addDataSet(lineDataSet);
return lineData;
}
示例4: setUpChart
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private boolean setUpChart(@NonNull Model model) {
final double[] accuracies = model.getAccuracies();
if (accuracies == null
|| accuracies.length == 0
|| model.getStepEpoch() < 1) {
return false;
}
mAccuracyData.clear();
for (int i = 0, len = model.getStepEpoch(); i < len; ++i) {
mAccuracyData.add(new Entry(i + 1, (float) accuracies[i]));
}
final LineDataSet set = new LineDataSet(mAccuracyData, getString(R.string.text_chart_left_axis));
set.setMode(LineDataSet.Mode.LINEAR);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setColor(ContextCompat.getColor(this, R.color.chart_left_axis));
set.setCircleColor(ContextCompat.getColor(this, R.color.chart_left_axis));
set.setHighLightColor(ContextCompat.getColor(this, R.color.chart_highlight));
set.setCircleColorHole(Color.WHITE);
set.setDrawCircleHole(true);
set.setHighlightEnabled(true);
set.setLineWidth(2F);
set.setCircleRadius(3F);
set.setDrawFilled(false);
final LineData group = new LineData(set);
group.setDrawValues(false);
setXAxis(model.getEpochs());
mChart.setData(group);
mChart.invalidate();
startChartAnimate();
return true;
}
示例5: updateGraph
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
public void updateGraph(){
List<Entry> entries = new ArrayList<>();
Last7Days newDays = AxisFormatter.reverseLast7Days(last7Days);
int i = 0;
for(long dataEntry : get7Days(newDays)){
entries.add(new Entry((float)i,(float)dataEntry));
i++;
}
LineDataSet dataSet = new LineDataSet(entries,context.getString(R.string.main_scores));
dataSet.setColor(ContextCompat.getColor(context,R.color.greenDark));
dataSet.setValueTextSize(14f);
dataSet.setValueFormatter(new IValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
return String.valueOf((int) value);
}
});
dataSet.setCircleColor(ContextCompat.getColor(context,R.color.greenPrimary));
dataSet.setLineWidth(3f);
dataSet.setCircleRadius(10f);
dataSet.setDrawValues(false);
dataSet.setHighlightEnabled(true);
LineData lineData = new LineData(dataSet);
graph.setData(lineData);
Description description = new Description();
description.setEnabled(false);
description.setText("");
graph.setDescription(description);
graph.setNoDataText(context.getString(R.string.main_connecting));
graph.setNoDataTextColor(ContextCompat.getColor(context,R.color.greenDark));
graph.setDrawGridBackground(false);
graph.setDrawBorders(false);
YAxis leftAxis = graph.getAxisLeft();
leftAxis.setEnabled(false);
leftAxis.setAxisMinimum(0);
YAxis rightAxis = graph.getAxisRight();
rightAxis.setEnabled(false);
XAxis xAxis = graph.getXAxis();
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());
ArrayList<Date> dateArrayList = new ArrayList<>();
for(int count = 0;count<7;count++){
Date date = c.getTime();
dateArrayList.add(date);
c.setTimeInMillis(c.getTimeInMillis() - ((long) 1000 * 60 * 60 * 24 ));
}
Collections.reverse(dateArrayList);
xAxis.setValueFormatter(new AxisFormatter(context,dateArrayList,dateFormatPattern));
xAxis.setTextSize(10f);
graph.setTouchEnabled(false);
graph.setDragEnabled(false);
graph.setScaleEnabled(false);
graph.setScaleXEnabled(false);
graph.setScaleYEnabled(false);
graph.setPinchZoom(false);
graph.setDoubleTapToZoomEnabled(false);
Legend legend = graph.getLegend();
legend.setEnabled(false);
graph.invalidate();
}