本文整理汇总了Java中com.github.mikephil.charting.data.LineDataSet.setDrawCircleHole方法的典型用法代码示例。如果您正苦于以下问题:Java LineDataSet.setDrawCircleHole方法的具体用法?Java LineDataSet.setDrawCircleHole怎么用?Java LineDataSet.setDrawCircleHole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.setDrawCircleHole方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createLineChartData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
public LineData createLineChartData()
{
mDashboardHelper = new DashboardHelper(getActivity());
HashMap<String, ArrayList> holder = mDashboardHelper.generateBeaconTotalDurationPerDayMap();
ArrayList<String> xValues = holder.get("dayOfThisMonth");
ArrayList<Entry> entries = holder.get("totalDurationPerDay");
LineDataSet set = new LineDataSet(entries, "");
set.setCircleColor(0xFF2196f3);
set.setCircleRadius(4f);
set.setDrawCircleHole(false);
set.setColor(0xFF2196f3);
set.setLineWidth(2f);
set.setDrawValues(false);
return new LineData(xValues, set);
}
示例3: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {
// now in hours
long now = TimeUnit.MILLISECONDS.toHours(System.currentTimeMillis());
ArrayList<Entry> values = new ArrayList<Entry>();
float from = now;
// count = hours
float to = now + count;
// increment by 1 hour
for (float x = from; x < to; x++) {
float y = getRandom(range, 50);
values.add(new Entry(x, y)); // add one entry per hour
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(values, "DataSet 1");
set1.setAxisDependency(AxisDependency.LEFT);
set1.setColor(ColorTemplate.getHoloBlue());
set1.setValueTextColor(ColorTemplate.getHoloBlue());
set1.setLineWidth(1.5f);
set1.setDrawCircles(false);
set1.setDrawValues(false);
set1.setFillAlpha(65);
set1.setFillColor(ColorTemplate.getHoloBlue());
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setDrawCircleHole(false);
// create a data object with the datasets
LineData data = new LineData(set1);
data.setValueTextColor(Color.WHITE);
data.setValueTextSize(9f);
// set data
mChart.setData(data);
}
示例4: setupDatasetWithDefaultValues
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setupDatasetWithDefaultValues(LineDataSet dataSet) {
dataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
dataSet.setColor(ColorTemplate.getHoloBlue());
dataSet.setValueTextColor(ColorTemplate.getHoloBlue());
dataSet.setLineWidth(1.5f);
dataSet.setDrawCircles(false);
dataSet.setDrawValues(false);
dataSet.setFillAlpha(65);
dataSet.setFillColor(ColorTemplate.getHoloBlue());
dataSet.setHighLightColor(Color.rgb(244, 117, 117));
dataSet.setDrawCircleHole(false);
}
示例5: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData() {
List<Entry> entries = data.getList();
for(Entry e: entries){
Date d= new Date((long) e.getX());
Log.d(Const.TAG2, "Next Entry is "+d.toString()+" , "+e.getY());
}
LineDataSet dataSet = new LineDataSet(entries, "Hourly Weather report");
dataSet.setColor(Color.rgb(184, 235, 161));
dataSet.setDrawCircleHole(false);
dataSet.setCircleColor(Color.CYAN);
dataSet.setValueTextColor(Color.WHITE);
dataSet.setValueTextSize(15);
dataSet.setDrawFilled(true);
dataSet.setFillColor(Color.LTGRAY);
dataSet.setDrawValues(true);
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
dataSet.setValueFormatter(new IValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
int newValue = (int) value;
return newValue + Const.DEGREE;
}
});
LineData lineData = new LineData(dataSet);
lineChart.setData(lineData);
lineChart.invalidate();//refresh
}
示例6: 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;
}
示例7: getNewChartLineDataSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet getNewChartLineDataSet(Context context, String label){
LineDataSet chartLineDataSet = new LineDataSet(new ArrayList<Entry>(), label);
chartLineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
chartLineDataSet.setLineWidth(3);
chartLineDataSet.setCircleRadius(3.5f);
chartLineDataSet.setDrawCircleHole(false);
chartLineDataSet.setColor(ContextCompat.getColor(context, R.color.colorPrimary), 200);
chartLineDataSet.setCircleColor(ContextCompat.getColor(context, R.color.colorPrimary));
chartLineDataSet.setDrawValues(false);
return chartLineDataSet;
}
示例8: chartDataSetStyling
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void chartDataSetStyling(LineDataSet dataSet) {
dataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
dataSet.setColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ?
getResources().getColor(R.color.traffic_chart_line_color_light) :
getResources().getColor(R.color.traffic_chart_line_color_dark));
dataSet.setLineWidth(2f);
dataSet.setCircleRadius(4f);
dataSet.setDrawValues(false);
dataSet.setDrawCircleHole(false);
dataSet.setCircleColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ?
getResources().getColor(R.color.traffic_chart_line_color_light) :
getResources().getColor(R.color.traffic_chart_line_color_dark));
}
示例9: generateAverageLineData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineData generateAverageLineData(List<MarketHistory> historyEntries) {
SimpleDateFormat format = new SimpleDateFormat("MMM dd", Locale.getDefault());
int size = historyEntries.size();
List<Entry> entries = new ArrayList<>(size);
List<String> xAxis = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
MarketHistory history = historyEntries.get(i);
Date recordDate = new Date(history.getRecordDate());
xAxis.add(format.format(recordDate));
entries.add(new Entry((float) history.getAveragePrice(), i));
}
LineDataSet set = new LineDataSet(entries, "Price Averages");
set.setColor(Color.RED);
set.setDrawCircles(false);
set.setDrawCircleHole(false);
set.setLineWidth(2.0f);
set.setDrawCubic(false);
set.setDrawValues(false);
set.setDrawHighlightIndicators(false);
set.setDrawVerticalHighlightIndicator(false);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
return new LineData(xAxis, set);
}
示例10: loadData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineData loadData(ChartCard card) {
// add entries to dataset
LineDataSet lineDataSet = new LineDataSet(card.entries, null);
lineDataSet.setMode(LineDataSet.Mode.LINEAR);
lineDataSet.setDrawValues(false);
lineDataSet.setDrawCircleHole(false);
lineDataSet.setColor(card.color);
lineDataSet.setCircleColor(card.color);
lineDataSet.setLineWidth(1.8f);
lineDataSet.setDrawFilled(true);
lineDataSet.setFillColor(card.color);
return new LineData(lineDataSet);
}
示例11: createLineChartData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
public LineData createLineChartData()
{
ArrayList<String> xValues = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
xValues.add(i + "");
}
ArrayList<Entry> entries = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
float mult = (5 + 1);
int val = (int) (Math.random() * mult) + 1;
entries.add(new Entry(val, i));
}
LineDataSet set = new LineDataSet(entries, "");
set.setCircleColor(0xFF2196f3);
set.setCircleRadius(4f);
set.setDrawCircleHole(false);
set.setColor(0xFF2196f3);
set.setLineWidth(2f);
set.setDrawValues(false);
return new LineData(xValues, set);
}
示例12: setupGraphic
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setupGraphic(LineChart chart, List<Entry> entries, float axisMinimum, IAxisValueFormatter formatter) {
LineDataSet dataSet = new LineDataSet(entries, Constants.EMPTY_STRING);
dataSet.setDrawCircles(false);
dataSet.setDrawCircleHole(false);
dataSet.setLineWidth(ResourcesHelper.getDimensionPixelSize(this, R.dimen.half_dp));
dataSet.setFillColor(getResources().getColor(R.color.colorPrimary));
dataSet.setDrawFilled(true);
dataSet.setFillAlpha(Constants.Chart.ALPHA_FILL);
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
dataSet.setColor(getResources().getColor(R.color.colorPrimary));
dataSet.setDrawValues(false);
LineData lineData = new LineData(dataSet);
chart.getDescription().setEnabled(false);
chart.setTouchEnabled(false);
chart.getLegend().setEnabled(false);
chart.getAxisRight().setEnabled(false);
chart.getXAxis().setDrawLabels(false);
chart.getXAxis().setDrawGridLines(false);
chart.getAxisLeft().removeAllLimitLines();
chart.getAxisLeft().setTextColor(getResources().getColor(R.color.gray));
chart.getAxisLeft().setAxisMinimum(axisMinimum);
chart.getAxisLeft().setTextSize(Constants.Chart.LABEL_SIZE);
chart.getAxisLeft().setValueFormatter(formatter);
chart.animateX(Constants.Chart.ANIMATION_DURATION, Easing.EasingOption.EaseInSine);
chart.setData(lineData);
chart.invalidate();
}
示例13: generateLineDataSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet generateLineDataSet(List<Entry> yVals, int color) {
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "");
List<Integer> colors = new ArrayList<>();
if (color == getResources().getColor(R.color.glucosio_pink)) {
for (Entry yVal : yVals) {
if (yVal.getVal() == (0)) {
colors.add(Color.TRANSPARENT);
} else {
colors.add(color);
}
}
set1.setCircleColors(colors);
} else {
set1.setCircleColor(color);
}
set1.setColor(color);
set1.setLineWidth(2f);
set1.setCircleSize(4f);
set1.setDrawCircleHole(true);
set1.disableDashedLine();
set1.setFillAlpha(255);
set1.setDrawFilled(true);
set1.setValueTextSize(0);
set1.setValueTextColor(Color.parseColor("#FFFFFF"));
set1.setFillDrawable(getResources().getDrawable(R.drawable.graph_gradient));
set1.setHighLightColor(getResources().getColor(R.color.glucosio_gray_light));
set1.setCubicIntensity(0.2f);
// TODO: Change this to true when a fix is available
// https://github.com/PhilJay/MPAndroidChart/issues/1541
set1.setDrawCubic(false);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
set1.setDrawFilled(false);
set1.setLineWidth(2f);
set1.setCircleSize(4f);
set1.setDrawCircleHole(true);
}
return set1;
}
示例14: makeLineData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet makeLineData(List<GlucoseData> glucoseDataList) {
String title = "History";
if (glucoseDataList.get(0).isTrendData()) title = "Trend";
LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), title);
for (GlucoseData gd : glucoseDataList) {
float x = convertDateToXAxisValue(gd.getDate());
float y = gd.glucose();
lineDataSet.addEntryOrdered(new Entry(x, y));
/*
Log.d(LOG_ID, String.format("%s: %s -> %s: %f -> %f",
title,
mFormatDateTime.format(new Date(gd.date)),
mFormatDateTime.format(new Date(convertXAxisValueToDate(x))),
x,
y)
);
*/
}
lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
lineDataSet.setDrawCircles(true);
lineDataSet.setCircleRadius(2f);
lineDataSet.setDrawCircleHole(false);
lineDataSet.setDrawValues(false);
lineDataSet.setDrawHighlightIndicators(true);
int baseColor = PLOT_COLORS[mPlotColorIndex % NUM_PLOT_COLORS][0];
int softColor = Color.argb(150, Color.red(baseColor), Color.green(baseColor), Color.blue(baseColor));
int hardColor = PLOT_COLORS[mPlotColorIndex % NUM_PLOT_COLORS][1];
if (glucoseDataList.get(0).isTrendData()) {
lineDataSet.setColor(hardColor);
lineDataSet.setLineWidth(2f);
lineDataSet.setCircleColor(softColor);
lineDataSet.setMode(LineDataSet.Mode.LINEAR);
} else {
lineDataSet.setColor(softColor);
lineDataSet.setLineWidth(4f);
lineDataSet.setCircleColor(hardColor);
lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
lineDataSet.setCubicIntensity(0.1f);
}
return lineDataSet;
}
示例15: refresh
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
public void refresh() {
SharedPreferences sharedPrefs = PreferenceManager
.getDefaultSharedPreferences(view.getContext().getApplicationContext());
ImageView iv_unit;
iv_unit = (ImageView)view.findViewById(R.id.iv_unit);
if(sharedPrefs.getString("pref_unit", "mg/dl").equals("mg/dl")) {
iv_unit.setImageResource(R.drawable.unit_mgdl);
}else{
iv_unit.setImageResource(R.drawable.unit_mmoll);
}
LineChart cv_LastScan = (LineChart) view.findViewById(R.id.cv_LastScan);
YAxis yAxisLeft = cv_LastScan.getAxisLeft();
yAxisLeft.removeAllLimitLines();
LimitLine ll_max = new LimitLine(Float.valueOf(sharedPrefs.getString("pref_zb_max", "-100.0")), getResources().getString(R.string.pref_zb_max));
ll_max.setLineWidth(4f);
ll_max.setTextSize(12f);
LimitLine ll_min = new LimitLine(Float.valueOf(sharedPrefs.getString("pref_zb_min", "-100.0")), getResources().getString(R.string.pref_zb_min));
ll_min.setLineWidth(4f);
ll_min.setTextSize(12f);
ll_min.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
Legend legend = cv_LastScan.getLegend();
legend.setEnabled(false);
// set an alternative background color
if(sharedPrefs.getBoolean("pref_nightmode", false)) {
cv_LastScan.setBackgroundColor(getResources().getColor(R.color.colorBackgroundDark));
ll_max.setLineColor(getResources().getColor(R.color.colorZielbereichDark));
ll_max.setTextColor(getResources().getColor(R.color.colorZielbereichDark));
ll_min.setLineColor(getResources().getColor(R.color.colorZielbereichDark));
ll_min.setTextColor(getResources().getColor(R.color.colorZielbereichDark));
}else{
cv_LastScan.setBackgroundColor(getResources().getColor(R.color.colorBackgroundLight));
ll_max.setLineColor(getResources().getColor(R.color.colorZielbereichLight));
ll_max.setTextColor(getResources().getColor(R.color.colorZielbereichLight));
ll_min.setLineColor(getResources().getColor(R.color.colorZielbereichLight));
ll_min.setTextColor(getResources().getColor(R.color.colorZielbereichLight));
}
yAxisLeft.addLimitLine(ll_max);
yAxisLeft.addLimitLine(ll_min);
/* if(cv_LastScan.getData() != null) {
if( cv_LastScan.getData().getDataSets().get(0).getYMax() < Float.valueOf(sharedPrefs.getString("pref_default_range", "0.0"))) {
yAxisLeft.setAxisMaxValue(Float.valueOf(sharedPrefs.getString("pref_default_range", "0.0")));
}
}*/
ArrayList<Entry> yVals = new ArrayList<Entry>();
yVals.add(new Entry(Float.valueOf(sharedPrefs.getString("pref_zb_max", "-100.0")), 0));
yVals.add(new Entry(Float.valueOf(sharedPrefs.getString("pref_zb_max", "-100.0")), cv_LastScan.getXAxis().getValues().size() - 1));
LineDataSet setarea = new LineDataSet(yVals, "area");
setarea.setLineWidth(4f);
setarea.setDrawCircleHole(false);
setarea.setDrawCircles(false);
setarea.setDrawValues(false);
setarea.setDrawCubic(false);
setarea.setDrawHighlightIndicators(false);
ArrayList<LineDataSet> areaSets = new ArrayList<LineDataSet>();
areaSets.add(setarea); // add the datasets
// create a data object with the datasets
if(cv_LastScan.getXAxis().getValues().size() > 2) {
LineData ld_area = new LineData(cv_LastScan.getXAxis().getValues(), areaSets);
cv_LastScan.setData(ld_area);
}
}