本文整理汇总了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();
}