本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart类的典型用法代码示例。如果您正苦于以下问题:Java LineChart类的具体用法?Java LineChart怎么用?Java LineChart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineChart类属于com.github.mikephil.charting.charts包,在下文中一共展示了LineChart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
mChart.getDescription().setEnabled(false);
// add an empty data object
mChart.setData(new LineData());
// mChart.getXAxis().setDrawLabels(false);
// mChart.getXAxis().setDrawGridLines(false);
mChart.invalidate();
}
示例2: prepareInitData
import com.github.mikephil.charting.charts.LineChart; //导入依赖的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;
}
示例3: initChart
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
/**
* Initialize the non-data aspects of the line chart
*/
private void initChart(){
//Initial line Chart for visualization of statistic
lineChart = (LineChart) findViewById(R.id.LineChart);
lineChart.setDragEnabled(true);
lineChart.setScaleEnabled(false);
lineChart.getAxisRight().setEnabled(false);
lineChart.getDescription().setEnabled(false);
YAxis leftAxis = lineChart.getAxisLeft();
leftAxis.removeAllLimitLines();
leftAxis.setAxisMaximum(100f);
leftAxis.setAxisMinimum(0.0f);
leftAxis.enableGridDashedLine(10f, 10f, 0f);
leftAxis.setDrawLimitLinesBehindData(true);
}
示例4: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_colored_lines);
mCharts[0] = (LineChart) findViewById(R.id.chart1);
mCharts[1] = (LineChart) findViewById(R.id.chart2);
mCharts[2] = (LineChart) findViewById(R.id.chart3);
mCharts[3] = (LineChart) findViewById(R.id.chart4);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");
for (int i = 0; i < mCharts.length; i++) {
LineData data = getData(36, 100);
data.setValueTypeface(mTf);
// add some transparency to the color with "& 0x90FFFFFF"
setupChart(mCharts[i], data, mColors[i % mColors.length]);
}
}
示例5: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_realm_wiki);
lineChart = (LineChart) findViewById(R.id.lineChart);
barChart = (BarChart) findViewById(R.id.barChart);
setup(lineChart);
setup(barChart);
lineChart.setExtraBottomOffset(5f);
barChart.setExtraBottomOffset(5f);
lineChart.getAxisLeft().setDrawGridLines(false);
lineChart.getXAxis().setDrawGridLines(false);
lineChart.getXAxis().setLabelCount(5);
lineChart.getXAxis().setGranularity(1f);
barChart.getAxisLeft().setDrawGridLines(false);
barChart.getXAxis().setDrawGridLines(false);
barChart.getXAxis().setLabelCount(5);
barChart.getXAxis().setGranularity(1f);
}
示例6: addDragListenerMarkerMaker
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
private void addDragListenerMarkerMaker(LineChart speedChart) {
speedChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
@Override
public void onValueSelected(Entry entry, Highlight h) {
Long entryX = (long) entry.getX();
if (timeLocationMap.containsKey(entryX)) {
clearAllMarkersFromMap();
LatLng latLng = timeLocationMap.get(entryX);
mapMarkers.add(googleMap.addMarker(new MarkerOptions().position(latLng)));
}
}
@Override
public void onNothingSelected() {
clearAllMarkersFromMap();
}
});
}
示例7: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_device, container, false);
mXAxis = (TextView) layout.findViewById(R.id.tvXAxis);
mYAxis = (TextView) layout.findViewById(R.id.tvYAxis);
mZAxis = (TextView) layout.findViewById(R.id.tvZAxis);
mMax = (TextView) layout.findViewById(R.id.tvMax);
mStart = (Button) layout.findViewById(R.id.bStart);
mStop = (Button) layout.findViewById(R.id.bStop);
mExport = (Button) layout.findViewById(R.id.bExport);
mChart = (LineChart) layout.findViewById(R.id.chart);
mChart.setDescription(null);
mChart.setHighlightPerDragEnabled(false);
mChart.setHighlightPerTapEnabled(false);
mChart.setPinchZoom(true);
mChart.getLegend().setDrawInside(true);
mChart.setExtraTopOffset(10);
mStart.setOnClickListener(this);
mStop.setOnClickListener(this);
mExport.setOnClickListener(this);
return layout;
}
示例8: populateDiagram
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@BindingAdapter({"bind:items"})
public static void populateDiagram(LineChart view, List<SingleValue> items) {
if (null == items || items.size() == 0) {
return;
}
List<Entry> entries = new ArrayList<>();
for (int i = 0; i < items.size(); i++) {
final SingleValue item = items.get(i);
final Entry entry = new Entry(i, (float) item.getValue(), item);
entries.add(entry);
}
LineDataSet dataSet = new LineDataSet(entries, view.getContext().getString(R.string.currency_value));
LineData lineData = new LineData(dataSet);
formatXAxisLabels(view, items);
view.setData(lineData);
view.invalidate();
}
示例9: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
mChart.setDescription("");
// add an empty data object
mChart.setData(new LineData());
// mChart.getXAxis().setDrawLabels(false);
// mChart.getXAxis().setDrawGridLines(false);
mChart.invalidate();
}
示例10: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_colored_lines);
mCharts[0] = (LineChart) findViewById(R.id.chart1);
mCharts[1] = (LineChart) findViewById(R.id.chart2);
mCharts[2] = (LineChart) findViewById(R.id.chart3);
mCharts[3] = (LineChart) findViewById(R.id.chart4);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");
LineData data = getData(36, 100);
data.setValueTypeface(mTf);
for (int i = 0; i < mCharts.length; i++)
// add some transparency to the color with "& 0x90FFFFFF"
setupChart(mCharts[i], data, mColors[i % mColors.length]);
}
示例11: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_realm_wiki);
lineChart = (LineChart) findViewById(R.id.lineChart);
barChart = (BarChart) findViewById(R.id.barChart);
setup(lineChart);
setup(barChart);
lineChart.setExtraBottomOffset(5f);
barChart.setExtraBottomOffset(5f);
lineChart.getAxisLeft().setDrawGridLines(false);
lineChart.getXAxis().setDrawGridLines(false);
barChart.getAxisLeft().setDrawGridLines(false);
barChart.getXAxis().setDrawGridLines(false);
}
示例12: refreshTemperatureChart
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
public void refreshTemperatureChart(LineChart temperatureChart, MarsI2cControl i2cControl) {
int[] c = {0,0,0,0};
float[] tempValues = {i2cControl.getT1(), i2cControl.getT2(), i2cControl.getT3(), i2cControl.getGlobalTemp()};
for (int i=0;i<4;i++) {
c[i] = temperatureChart.getLineData().getDataSetByIndex(i).getEntryCount();
temperatureChart.getLineData().getDataSetByIndex(i).removeFirst();
temperatureChart.getLineData().getDataSetByIndex(i).addEntry(new Entry(c[i]++ + auxForTemperatureBuffer[i], tempValues[i]));
auxForTemperatureBuffer[i]++;
}
temperatureChart.getLineData().notifyDataChanged();
temperatureChart.notifyDataSetChanged();
temperatureChart.invalidate();
}
示例13: refreshGasesChart
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
public void refreshGasesChart(LineChart gasesChart, MarsI2cControl i2cControl) {
int[] c = {0,0};
float[] tempValues = {i2cControl.getO2(), i2cControl.getCo2()};
for (int i=0;i<2;i++) {
c[i] = gasesChart.getLineData().getDataSetByIndex(i).getEntryCount();
gasesChart.getLineData().getDataSetByIndex(i).removeFirst();
gasesChart.getLineData().getDataSetByIndex(i).addEntry(new Entry(c[i]++ + auxForGasesBuffer[i], tempValues[i]));
auxForGasesBuffer[i]++;
}
gasesChart.getLineData().notifyDataChanged();
gasesChart.notifyDataSetChanged();
gasesChart.invalidate();
}
示例14: chartStyling
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void chartStyling(LineChart chart) {
chart.setTouchEnabled(false);
chart.setDescription("");
chart.setAutoScaleMinMaxEnabled(false);
chart.setNoDataTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ? Color.BLACK : Color.WHITE);
YAxis axisRight = chart.getAxisRight();
axisRight.setEnabled(false);
chart.getLegend().setEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
chart.setNestedScrollingEnabled(false);
}
XAxis xAxis = chart.getXAxis();
chartXAxisStyling(xAxis);
YAxis yAxis = chart.getAxisLeft();
chartYAxisStyling(yAxis);
}
示例15: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);
mChart.setGridBackgroundColor(mFillColor);
mChart.setDrawGridBackground(true);
mChart.setDrawBorders(true);
// no description text
mChart.getDescription().setEnabled(false);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
Legend l = mChart.getLegend();
l.setEnabled(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setAxisMaximum(900f);
leftAxis.setAxisMinimum(-250f);
leftAxis.setDrawAxisLine(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setDrawGridLines(false);
mChart.getAxisRight().setEnabled(false);
// add data
setData(100, 60);
mChart.invalidate();
}