本文整理汇总了Java中com.github.mikephil.charting.data.LineDataSet.setCubicIntensity方法的典型用法代码示例。如果您正苦于以下问题:Java LineDataSet.setCubicIntensity方法的具体用法?Java LineDataSet.setCubicIntensity怎么用?Java LineDataSet.setCubicIntensity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.setCubicIntensity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: styleChartLines
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
/**
* Style char lines (type, color, etc.).
*
* @param entries list of entries.
* @return line data chart.
*/
private LineData styleChartLines(List<Entry> entries) {
// Set styles
LineDataSet lineDataSet = new LineDataSet(entries, "Recording");
lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
lineDataSet.setCubicIntensity(0.2f);
lineDataSet.setDrawValues(false);
lineDataSet.setDrawCircles(false);
lineDataSet.setLineWidth(1.8f);
lineDataSet.setColor(ContextCompat.getColor(context, R.color.colorAccent));
if (((int) lineDataSet.getYMax()) != 0) {
lineDataSet.setDrawFilled(true);
lineDataSet.setFillAlpha(255);
// Fix bug with vectors in API < 21
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){
Drawable drawable = ResourcesCompat.getDrawable(context.getResources(),
R.drawable.chart_fade, null);
lineDataSet.setFillDrawable(drawable);
} else{
lineDataSet.setFillColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
}
return new LineData(lineDataSet);
}
示例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: 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;
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
}
示例7: setupBeesChart
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
/**
* Configure bees chart and the data.
*
* @param recordsList list of records.
*/
private void setupBeesChart(List<Record> recordsList) {
// Setup data
referenceTimestamp = recordsList.get(0).getTimestamp().getTime() / 1000;
Record[] records = recordsList.toArray(new Record[recordsList.size()]);
List<Entry> entries = new ArrayList<>();
int maxNumBees = 0;
for (Record record : records) {
// Convert timestamp to seconds and relative to first timestamp
long timestamp = record.getTimestamp().getTime() / 1000 - referenceTimestamp;
int numBees = record.getNumBees();
entries.add(new Entry(timestamp, numBees));
// Get max num of bees
if (numBees > maxNumBees) {
maxNumBees = numBees;
}
}
lastTimestamp = (long) entries.get(entries.size() - 1).getX();
// Style char lines (type, color, etc.)
LineDataSet lineDataSet = new LineDataSet(entries, getString(R.string.num_bees));
lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
lineDataSet.setCubicIntensity(0.2f);
lineDataSet.setDrawValues(false);
lineDataSet.setDrawCircles(false);
lineDataSet.setLineWidth(1.8f);
lineDataSet.setColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
// General setup
beesChart.setDrawGridBackground(false);
beesChart.setDrawBorders(false);
beesChart.setViewPortOffsets(80, 40, 80, 50);
beesChart.getDescription().setEnabled(false);
beesChart.getLegend().setEnabled(false);
beesChart.setTouchEnabled(true);
beesChart.setDragEnabled(false);
beesChart.setScaleEnabled(false);
beesChart.setPinchZoom(false);
BeesMarkerView mv = new BeesMarkerView(getContext(), R.layout.recording_bees_marker_vew);
mv.setChartView(beesChart);
beesChart.setMarker(mv);
beesChart.setNoDataText(getString(R.string.no_flight_act_data_available));
// X axis setup
IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter(referenceTimestamp);
XAxis xAxis = beesChart.getXAxis();
xAxis.setValueFormatter(xAxisFormatter);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextColor(Color.BLACK);
// Y axis setup
YAxis leftAxis = beesChart.getAxisLeft();
leftAxis.setAxisMaximum(maxNumBees > 40 ? maxNumBees + 2 : 40);
leftAxis.setAxisMinimum(0);
leftAxis.setDrawGridLines(true);
leftAxis.setDrawAxisLine(false);
YAxis rightAxis = beesChart.getAxisRight();
rightAxis.setAxisMaximum(maxNumBees > 40 ? maxNumBees + 2 : 40);
rightAxis.setAxisMinimum(0);
rightAxis.setDrawGridLines(true);
rightAxis.setDrawAxisLine(false);
// Add data
beesChart.setData(new LineData(lineDataSet));
}