本文整理汇总了Java中com.github.mikephil.charting.components.LimitLine.enableDashedLine方法的典型用法代码示例。如果您正苦于以下问题:Java LimitLine.enableDashedLine方法的具体用法?Java LimitLine.enableDashedLine怎么用?Java LimitLine.enableDashedLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.components.LimitLine
的用法示例。
在下文中一共展示了LimitLine.enableDashedLine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareChart
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
private void prepareChart() {
mChart.setTouchEnabled(true);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(true);
mChart.setHighlightPerTapEnabled(true);
mChart.setDoubleTapToZoomEnabled(false);
mChart.setHighlightPerDragEnabled(false);
mChart.getDescription().setEnabled(false);
mChart.setDrawGridBackground(false);
mChart.getLegend().setEnabled(true);
mChart.getAxisRight().setEnabled(false);
mChart.setMarker(new AMarkView(this, R.layout.ac_detail_mark_view));
final YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTextColor(ContextCompat.getColor(this, R.color.text_primary));
leftAxis.setAxisMaximum(1F);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawAxisLine(true);
final LimitLine upLine = new LimitLine(0.9F, "Great");
upLine.setLineWidth(2F);
upLine.enableDashedLine(10F, 10F, 10F);
upLine.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
upLine.setLineColor(ContextCompat.getColor(this, R.color.divider));
upLine.setTextColor(ContextCompat.getColor(this, R.color.green$1));
final LimitLine downLine = new LimitLine(0.5F, "Bad");
downLine.setLineWidth(2F);
downLine.enableDashedLine(10F, 10F, 10F);
downLine.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
downLine.setLineColor(ContextCompat.getColor(this, R.color.divider));
downLine.setTextColor(ContextCompat.getColor(this, R.color.pink_$1));
leftAxis.addLimitLine(upLine);
leftAxis.addLimitLine(downLine);
}
示例2: init
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
getDescription().setEnabled(false);
LimitLine llXAxis = new LimitLine(10f, "Index 10");
llXAxis.setLineWidth(4f);
llXAxis.enableDashedLine(10f, 10f, 0f);
llXAxis.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
llXAxis.setTextSize(10f);
XAxis xAxis = getXAxis();
// xAxis.enableGridDashedLine(10f, 10f, 0f);
xAxis.setDrawGridLines(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextColor(Color.GRAY);
LimitLine ll1 = new LimitLine(80f, "Avg");
ll1.setLineWidth(1f);
ll1.enableDashedLine(10f, 10f, 0f);
ll1.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
ll1.setTextSize(10f);
YAxis leftAxis = getAxisLeft();
leftAxis.removeAllLimitLines();
leftAxis.addLimitLine(ll1);
leftAxis.setAxisMaximum(160f);
leftAxis.setAxisMinimum(0f);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setTextColor(Color.GRAY);
leftAxis.setDrawLimitLinesBehindData(true);
getAxisRight().setEnabled(false);
Legend l = getLegend();
l.setForm(Legend.LegendForm.LINE);
}
示例3: getChartLimitLine
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
private LimitLine getChartLimitLine(float value, String label) {
LimitLine line = new LimitLine(value, label);
float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
line.setLineWidth(2f);
line.enableDashedLine(12f, 12f, 0);
line.setLabelPosition(LimitLine.LimitLabelPosition.LEFT_BOTTOM);
line.setTextSize(10 * scaledDensity);
line.setTextColor(ContextCompat.getColor(this, R.color.text));
return line;
}
示例4: SetupChart
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
public void SetupChart() {
lineChart = (LineChart) myLayout.findViewById(R.id.chart);
lineChart.setDescription("");
lineChart.setDrawBorders(false);
lineChart.setNoDataTextDescription("You need to provide data for the chart.");
lineChart.setDrawGridBackground(false);
lineChart.setOnChartValueSelectedListener(this);
lineChart.setTouchEnabled(true);
lineChart.setDragEnabled(false);
lineChart.setPinchZoom(false);
lineChart.setScaleXEnabled(true);
lineChart.setScaleYEnabled(true);
lineChart.invalidate();
LineData data = new LineData();
data.setValueTextColor(Color.WHITE);
// add empty data
lineChart.setData(data);
// get the legend (only possible after setting data)
Legend l = lineChart.getLegend();
l.setEnabled(false);
// x axis setup
XAxis xl = lineChart.getXAxis();
xl.setTextColor(Color.WHITE);
xl.setDrawGridLines(false);
xl.setAvoidFirstLastClipping(false);
xl.setSpaceBetweenLabels(3);
xl.setEnabled(true);
xl.setDrawAxisLine(false);
xl.removeAllLimitLines();
//right y axis setup
YAxis rightAxis = lineChart.getAxisRight();
rightAxis.setEnabled(false);
//left y axis setup
YAxis leftAxis = lineChart.getAxisLeft();
leftAxis.setTextColor(Color.WHITE);
leftAxis.setLabelCount(6, true);
leftAxis.setAxisMaxValue(400f);
leftAxis.setAxisMinValue(0f);
leftAxis.setDrawGridLines(false);
leftAxis.setStartAtZero(false);
leftAxis.setEnabled(true);
leftAxis.setDrawAxisLine(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setGranularityEnabled(false);
//define min max line
LimitLine max = new LimitLine(150f);
max.enableDashedLine(10f, 10f, 0f);
LimitLine min = new LimitLine(50f);
min.enableDashedLine(10f, 10f, 0f);
// reset all limit lines to avoid overlapping lines
leftAxis.removeAllLimitLines();
//add min max line
leftAxis.addLimitLine(max);
leftAxis.addLimitLine(min);
lineChart.invalidate();
}
示例5: setData
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的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<>();
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.setFillAlpha(110);
// set1.setFillColor(Color.RED);
// set the line to be drawn like this "- - - - - -"
set1.enableDashedLine(10f, 5f, 0f);
set1.setColor(Color.BLACK);
set1.setCircleColor(Color.BLACK);
set1.setLineWidth(1f);
set1.setCircleSize(4f);
set1.setFillAlpha(65);
set1.setFillColor(Color.BLACK);
// set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(),
// Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
LimitLine ll1 = new LimitLine(130f);
ll1.setLineWidth(4f);
ll1.enableDashedLine(10f, 10f, 0f);
ll1.setLabelPosition(LimitLine.LimitLabelPosition.POS_RIGHT);
LimitLine ll2 = new LimitLine(130f);
ll2.setLineWidth(4f);
ll2.enableDashedLine(10f, 10f, 0f);
ll2.setLabelPosition(LimitLine.LimitLabelPosition.POS_RIGHT);
//YAxis.YAxisLabelPosition leftAxis = mChart.getY
// set data
mChart.setData(data);
}
示例6: setData
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
private void setData(List<TemperatureEntry> logSessionList) {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
int ttt = Integer.MIN_VALUE;
ArrayList<Entry> yVals = new ArrayList<>();
ArrayList<String> xVals = new ArrayList<>();
SimpleDateFormat df = new SimpleDateFormat(mDateFormat.split(" ")[1]);
for (int i = 0; i < logSessionList.size(); i++) {
TemperatureEntry temperatureEntry = logSessionList.get(i);
xVals.add(df.format(temperatureEntry.getTimestamp()));
Entry chartEntry = new Entry(logSessionList.get(i).getTemperature(), i, temperatureEntry);
yVals.add(chartEntry);
if (mLogSession.getTargetTemperature() != null &&
temperatureEntry.getTemperature() >= mLogSession.getTargetTemperature() &&
ttt == Integer.MIN_VALUE)
{
ttt = i;
}
if (temperatureEntry.getTemperature() < min) min = temperatureEntry.getTemperature();
if (temperatureEntry.getTemperature() > max) max = temperatureEntry.getTemperature();
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, getString(R.string.temperature));
// set1.setFillAlpha(110);
// set1.setFillColor(Color.RED);
// set the line to be drawn like this "- - - - - -"
set1.enableDashedLine(10f, 5f, 0f);
set1.setColor(Color.BLACK);
set1.setCircleColor(Color.BLACK);
set1.setLineWidth(2f);
set1.setDrawValues(false);
set1.setCircleSize(4f);
set1.setFillAlpha(65);
set1.setFillColor(Color.BLACK);
// set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(),
// Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
YAxis leftAxis = mChart.getAxisLeft();
if (mLogSession.getTargetTemperature() != null) {
String timeToTarget = "Target temperature";
if (ttt != Integer.MIN_VALUE) {
long duration = (logSessionList.get(ttt).getTimestamp().getTime() - logSessionList.get(0).getTimestamp().getTime()) / 1000;
timeToTarget = "Time to target temperature: " + String.format("%d:%02d:%02d", duration / 3600, (duration % 3600) / 60, (duration % 60));
}
LimitLine ll1 = new LimitLine(mLogSession.getTargetTemperature(), timeToTarget);
ll1.setLineWidth(4f);
ll1.enableDashedLine(10f, 10f, 0f);
ll1.setLabelPosition(LimitLine.LimitLabelPosition.POS_RIGHT);
ll1.setTextSize(10f);
leftAxis.addLimitLine(ll1);
}
leftAxis.setStartAtZero(true);
leftAxis.setAxisMaxValue(max + 10);
leftAxis.setAxisMinValue(min-10);
mChart.getAxisRight().setEnabled(false);
// set data
mChart.setData(data);
mChart.invalidate();
}
示例7: setupLimitLine
import com.github.mikephil.charting.components.LimitLine; //导入方法依赖的package包/类
private void setupLimitLine(LimitLine limitLine) {
limitLine.setLineWidth(2);
limitLine.setLineColor(Color.rgb(76, 153, 0));
limitLine.enableDashedLine(15f, 5f, 0f);
}