本文整理汇总了Java中com.github.mikephil.charting.data.LineDataSet.setDrawCubic方法的典型用法代码示例。如果您正苦于以下问题:Java LineDataSet.setDrawCubic方法的具体用法?Java LineDataSet.setDrawCubic怎么用?Java LineDataSet.setDrawCubic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.setDrawCubic方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateLineData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineData generateLineData() {
LineData d = new LineData();
ArrayList<Entry> entries = new ArrayList<Entry>();
for (int index = 0; index < itemcount; index++)
entries.add(new Entry(getRandom(15, 10), index));
LineDataSet set = new LineDataSet(entries, "Line DataSet");
set.setColor(Color.rgb(240, 238, 70));
set.setLineWidth(2.5f);
set.setCircleColor(Color.rgb(240, 238, 70));
set.setCircleRadius(5f);
set.setFillColor(Color.rgb(240, 238, 70));
set.setDrawCubic(true);
set.setDrawValues(true);
set.setValueTextSize(10f);
set.setValueTextColor(Color.rgb(240, 238, 70));
set.setAxisDependency(YAxis.AxisDependency.LEFT);
d.addDataSet(set);
return d;
}
示例2: createHeartrateSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
protected LineDataSet createHeartrateSet(List<Entry> values, String label) {
LineDataSet set1 = new LineDataSet(values, label);
set1.setLineWidth(0.8f);
set1.setColor(HEARTRATE_COLOR);
set1.setDrawCubic(true);
set1.setCubicIntensity(0.1f);
set1.setDrawCircles(false);
// set1.setCircleRadius(2f);
// set1.setDrawFilled(true);
// set1.setColor(getResources().getColor(android.R.color.background_light));
// set1.setCircleColor(HEARTRATE_COLOR);
// set1.setFillColor(ColorTemplate.getHoloBlue());
// set1.setHighLightColor(Color.rgb(128, 0, 255));
// set1.setColor(Color.rgb(89, 178, 44));
set1.setDrawValues(true);
set1.setValueTextColor(CHART_TEXT_COLOR);
set1.setAxisDependency(YAxis.AxisDependency.RIGHT);
return set1;
}
示例3: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((i) + "");
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 3;// + (float)
// ((mult *
// 0.1) / 10);
yVals.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
set1.setColor(Color.BLACK);
set1.setLineWidth(0.5f);
set1.setDrawValues(false);
set1.setDrawCircles(false);
set1.setDrawCubic(false);
set1.setDrawFilled(false);
// create a data object with the datasets
LineData data = new LineData(xVals, set1);
// set data
mChart.setData(data);
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
l.setEnabled(false);
}
示例4: marshallHumidity
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void marshallHumidity(List<HumidityHolder> humidity) {
final int count = humidity.size();
List<String> xVals = new ArrayList<>();
List<Entry> humidityList = new ArrayList<>();
for(int i = 0; i < count; ++i) {
HumidityHolder humidityHolder = humidity.get(i);
xVals.add(humidityHolder.getDate());
humidityList.add(new Entry(humidityHolder.getHumidity(), i));
}
LineDataSet lineDataSet = new LineDataSet(humidityList, "湿度");
lineDataSet.setDrawCubic(true);
lineDataSet.setDrawFilled(true);
lineDataSet.setDrawCircles(false);
lineDataSet.setCircleColor(Color.WHITE);
lineDataSet.setHighLightColor(m_context.getResources().getColor(R.color.max));
lineDataSet.setColor(Color.WHITE);
lineDataSet.setFillColor(m_context.getResources().getColor(R.color.fill));
lineDataSet.setFillAlpha(100);
LineData data = new LineData(xVals, lineDataSet);
data.setValueTextSize(5f);
m_iWeatherForecastView.showHumidity(data);
}
示例5: 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);
}
示例6: getData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@Override @WorkerThread
protected LineData getData(final List<Sensor> sensors, final List<Measurement> measurementList) {
if (measurementList.size() == 0) {
return null;
}
ArrayList<String> xVals = new ArrayList<>();
ArrayList<Entry> yVals = new ArrayList<>();
for (int i = 0; i < measurementList.size(); ++i) {
final Measurement m = measurementList.get(i);
final String x = dateFormat.format(m.getTimestamp());
xVals.add(x);
try {
float y = format.parse(String.valueOf(m.getValue())).floatValue();
yVals.add(new Entry(y, i));
} catch (ParseException e) {
e.printStackTrace();
}
}
LineDataSet dataSet = new LineDataSet(yVals, item.getTitle());
dataSet.setLineWidth(3f);
dataSet.setCircleSize(3f);
dataSet.setColor(getResources().getColor(R.color.supporting_color_light_purple));
dataSet.setCircleColor(getResources().getColor(R.color.supporting_color_dark_purple));
dataSet.setHighLightColor(getResources().getColor(R.color.supporting_color_light_purple));
dataSet.setDrawValues(false);
dataSet.setDrawCubic(true);
ArrayList<LineDataSet> dataSets = new ArrayList<>();
dataSets.add(dataSet);
return new LineData(xVals, dataSets);
}
示例7: 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;
}
示例8: 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);
}
}
示例9: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((1990 +i) + "");
}
ArrayList<Entry> vals1 = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 20;// + (float)
// ((mult *
// 0.1) / 10);
vals1.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
set1.setDrawCubic(true);
set1.setCubicIntensity(0.2f);
//set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(1.8f);
set1.setCircleRadius(4f);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.WHITE);
set1.setFillColor(Color.WHITE);
set1.setFillAlpha(100);
set1.setDrawHorizontalHighlightIndicator(false);
set1.setFillFormatter(new FillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
return -10;
}
});
// create a data object with the datasets
LineData data = new LineData(xVals, set1);
data.setValueTypeface(tf);
data.setValueTextSize(9f);
data.setDrawValues(false);
// set data
mChart.setData(data);
}
示例10: onCreate
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
Bundle extras = this.getIntent().getExtras();
if (extras != null && extras.getBoolean("stop", true)) {
this.finish();
}
gsonstringobject();
// Inflate the layout that we're using for the watch face
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myLayout = inflater.inflate(R.layout.wear_drip_watchface_layout, null);
LineChart lineChart = (LineChart) myLayout.findViewById(R.id.chart);
lineChart.setDescription("");
lineChart.setNoDataTextDescription("You need to provide data for the chart.");
ArrayList<Entry> entries = new ArrayList<>();
entries.add(new Entry(4f, 0));
entries.add(new Entry(8f, 1));
entries.add(new Entry(6f, 2));
entries.add(new Entry(2f, 3));
entries.add(new Entry(18f, 4));
entries.add(new Entry(9f, 5));
LineDataSet dataset = new LineDataSet(entries, "# of Calls");
ArrayList<String> labels = new ArrayList<String>();
labels.add("January");
labels.add("February");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
LineData data = new LineData(labels, dataset);
//dataset.setColors(ColorTemplate.COLORFUL_COLORS);
//dataset.setColors(ColorTemplate.VORDIPLOM_COLORS);
//dataset.setColors(ColorTemplate.JOYFUL_COLORS);
dataset.setColors(ColorTemplate.LIBERTY_COLORS);
//dataset.setColors(ColorTemplate.PASTEL_COLORS);
dataset.setDrawCubic(true);
dataset.setDrawFilled(true);
dataset.setDrawCircles(false);
dataset.setDrawValues(false);
lineChart.setPinchZoom(false);
lineChart.setDragEnabled(false);
lineChart.setScaleEnabled(false);
lineChart.setDrawGridBackground(false);
lineChart.setTouchEnabled(false);
lineChart.setData(data);
lineChart.animateY(5000);
// get the legend (only possible after setting data)
Legend l = lineChart.getLegend();
l.setEnabled(false);
XAxis xl = lineChart.getXAxis();
xl.setDrawGridLines(true);
xl.setEnabled(false);
YAxis leftAxis = lineChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
YAxis rightAxis = lineChart.getAxisRight();
rightAxis.setEnabled(false);
}
示例11: dataSetConfig
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@Override
void dataSetConfig(IDataSet<Entry> dataSet, ReadableMap config) {
LineDataSet lineDataSet = (LineDataSet) dataSet;
ChartDataSetConfigUtils.commonConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonBarLineScatterCandleBubbleConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonLineScatterCandleRadarConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonLineRadarConfig(lineDataSet, config);
// LineDataSet only config
if (BridgeUtils.validate(config, ReadableType.Number, "circleRadius")) {
lineDataSet.setCircleRadius((float) config.getDouble("circleRadius"));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCircles")) {
lineDataSet.setDrawCircles(config.getBoolean("drawCircles"));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCubic")) {
lineDataSet.setDrawCubic(config.getBoolean("drawCubic"));
}
if (BridgeUtils.validate(config, ReadableType.Number, "drawCubicIntensity")) {
lineDataSet.setCubicIntensity((float) config.getDouble("drawCubicIntensity"));
}
if (BridgeUtils.validate(config, ReadableType.String, "circleColor")) {
lineDataSet.setCircleColor(Color.parseColor(config.getString("circleColor")));
}
if (BridgeUtils.validate(config, ReadableType.Array, "circleColors")) {
lineDataSet.setCircleColors(BridgeUtils.parseColors(config.getArray("circleColors")));
}
if (BridgeUtils.validate(config, ReadableType.String, "circleColorHole")) {
lineDataSet.setCircleColorHole(Color.parseColor(config.getString("circleColorHole")));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCircleHole")) {
lineDataSet.setDrawCircleHole(config.getBoolean("drawCircleHole"));
}
if (BridgeUtils.validate(config, ReadableType.Map, "dashedLine")) {
ReadableMap dashedLine = config.getMap("dashedLine");
float lineLength = 0;
float spaceLength = 0;
float phase = 0;
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "lineLength")) {
lineLength = (float) dashedLine.getDouble("lineLength");
}
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "spaceLength")) {
spaceLength = (float) dashedLine.getDouble("spaceLength");
}
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "phase")) {
phase = (float) dashedLine.getDouble("phase");
}
lineDataSet.enableDashedLine(lineLength, spaceLength, phase);
}
}
示例12: setupHistoryChart
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setupHistoryChart(BarLineChartBase chart) {
configureBarLineChartDefaults(chart);
chart.setTouchEnabled(false); // no zooming or anything, because it's updated all the time
chart.setBackgroundColor(BACKGROUND_COLOR);
chart.setDescriptionColor(DESCRIPTION_COLOR);
chart.setDescription(getString(R.string.live_activity_steps_per_minute_history));
chart.setNoDataText(getString(R.string.live_activity_start_your_activity));
chart.getLegend().setEnabled(false);
Paint infoPaint = chart.getPaint(Chart.PAINT_INFO);
infoPaint.setTextSize(Utils.convertDpToPixel(20f));
infoPaint.setFakeBoldText(true);
chart.setPaint(infoPaint, Chart.PAINT_INFO);
XAxis x = chart.getXAxis();
x.setDrawLabels(true);
x.setDrawGridLines(false);
x.setEnabled(true);
x.setTextColor(CHART_TEXT_COLOR);
x.setDrawLimitLinesBehindData(true);
YAxis y = chart.getAxisLeft();
y.setDrawGridLines(false);
y.setDrawTopYLabelEntry(false);
y.setTextColor(CHART_TEXT_COLOR);
y.setEnabled(true);
y.setAxisMinValue(0);
YAxis yAxisRight = chart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setEnabled(true);
yAxisRight.setDrawLabels(true);
yAxisRight.setDrawTopYLabelEntry(false);
yAxisRight.setTextColor(CHART_TEXT_COLOR);
yAxisRight.setAxisMaxValue(HeartRateUtils.MAX_HEART_RATE_VALUE);
yAxisRight.setAxisMinValue(HeartRateUtils.MIN_HEART_RATE_VALUE);
mHistorySet = new LineDataSet(new ArrayList<Entry>(), getString(R.string.live_activity_steps_history));
mHistorySet.setAxisDependency(YAxis.AxisDependency.LEFT);
mHistorySet.setColor(akActivity.color);
mHistorySet.setDrawCircles(false);
mHistorySet.setDrawCubic(true);
mHistorySet.setDrawFilled(true);
mHistorySet.setDrawValues(false);
mHeartRateSet = createHeartrateSet(new ArrayList<Entry>(), getString(R.string.live_activity_heart_rate));
mHeartRateSet.setDrawValues(false);
}