2525import com .github .mikephil .charting .utils .Legend ;
2626import com .github .mikephil .charting .utils .Legend .LegendForm ;
2727import com .github .mikephil .charting .utils .LimitLine .LimitLabelPosition ;
28+ import com .github .mikephil .charting .utils .Highlight ;
2829import com .github .mikephil .charting .utils .LimitLine ;
2930import com .github .mikephil .charting .utils .XLabels ;
3031import com .xxmassdeveloper .mpchartexample .notimportant .DemoBase ;
@@ -60,7 +61,7 @@ protected void onCreate(Bundle savedInstanceState) {
6061 mChart = (LineChart ) findViewById (R .id .chart1 );
6162 mChart .setOnChartGestureListener (this );
6263 mChart .setOnChartValueSelectedListener (this );
63-
64+
6465 mChart .setUnit (" $" );
6566 mChart .setDrawUnitsInChart (true );
6667
@@ -72,7 +73,7 @@ protected void onCreate(Bundle savedInstanceState) {
7273
7374 mChart .setDrawBorder (true );
7475 mChart .setBorderPositions (new BorderPosition [] {
75- BorderPosition .BOTTOM
76+ BorderPosition .BOTTOM
7677 });
7778
7879 // no description text
@@ -119,12 +120,12 @@ protected void onCreate(Bundle savedInstanceState) {
119120 // enable/disable highlight indicators (the lines that indicate the
120121 // highlighted Entry)
121122 mChart .setHighlightIndicatorEnabled (false );
122-
123+
123124 // add data
124125 setData (45 , 100 );
125126
126127 mChart .animateX (2500 );
127-
128+
128129 // // restrain the maximum scale-out factor
129130 // mChart.setScaleMinima(3f, 3f);
130131 //
@@ -138,8 +139,8 @@ protected void onCreate(Bundle savedInstanceState) {
138139 // l.setPosition(LegendPosition.LEFT_OF_CHART);
139140 l .setForm (LegendForm .LINE );
140141
141- // // dont forget to refresh the drawing
142- // mChart.invalidate();
142+ // // dont forget to refresh the drawing
143+ // mChart.invalidate();
143144 }
144145
145146 @ Override
@@ -260,15 +261,19 @@ public boolean onOptionsItemSelected(MenuItem item) {
260261 mChart .disableFiltering ();
261262 }
262263 mChart .invalidate ();
263-
264- //
265- // for(int i = 0; i < 10; i++) {
266- // mChart.addEntry(new Entry((float) (Math.random() * 100), i+2), 0);
267- // mChart.invalidate();
268- // }
269- //
270- // Toast.makeText(getApplicationContext(), "valcount: " + mChart.getDataOriginal().getYValCount() + ", valsum: " + mChart.getDataOriginal().getYValueSum(), Toast.LENGTH_SHORT).show();
271- //
264+
265+ //
266+ // for(int i = 0; i < 10; i++) {
267+ // mChart.addEntry(new Entry((float) (Math.random() * 100),
268+ // i+2), 0);
269+ // mChart.invalidate();
270+ // }
271+ //
272+ // Toast.makeText(getApplicationContext(), "valcount: " +
273+ // mChart.getDataOriginal().getYValCount() + ", valsum: " +
274+ // mChart.getDataOriginal().getYValueSum(),
275+ // Toast.LENGTH_SHORT).show();
276+ //
272277 break ;
273278 }
274279 case R .id .actionSave : {
@@ -326,11 +331,11 @@ private void setData(int count, float range) {
326331 // 0.1) / 10);
327332 yVals .add (new Entry (val , i ));
328333 }
329-
334+
330335 // create a dataset and give it a type
331336 LineDataSet set1 = new LineDataSet (yVals , "DataSet 1" );
332- // set1.setFillAlpha(110);
333- // set1.setFillColor(Color.RED);
337+ // set1.setFillAlpha(110);
338+ // set1.setFillColor(Color.RED);
334339
335340 // set the line to be drawn like this "- - - - - -"
336341 set1 .enableDashedLine (10f , 5f , 0f );
@@ -340,26 +345,27 @@ private void setData(int count, float range) {
340345 set1 .setCircleSize (4f );
341346 set1 .setFillAlpha (65 );
342347 set1 .setFillColor (Color .BLACK );
343- // set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
348+ // set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(),
349+ // Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
344350
345351 ArrayList <LineDataSet > dataSets = new ArrayList <LineDataSet >();
346352 dataSets .add (set1 ); // add the datasets
347353
348354 // create a data object with the datasets
349355 LineData data = new LineData (xVals , dataSets );
350-
356+
351357 LimitLine ll1 = new LimitLine (130f );
352358 ll1 .setLineWidth (4f );
353359 ll1 .enableDashedLine (10f , 10f , 0f );
354360 ll1 .setDrawValue (true );
355361 ll1 .setLabelPosition (LimitLabelPosition .RIGHT );
356-
362+
357363 LimitLine ll2 = new LimitLine (-30f );
358364 ll2 .setLineWidth (4f );
359365 ll2 .enableDashedLine (10f , 10f , 0f );
360366 ll2 .setDrawValue (true );
361367 ll2 .setLabelPosition (LimitLabelPosition .RIGHT );
362-
368+
363369 data .addLimitLine (ll1 );
364370 data .addLimitLine (ll2 );
365371
@@ -374,19 +380,19 @@ public void onChartLongPressed(MotionEvent me) {
374380
375381 @ Override
376382 public void onChartDoubleTapped (MotionEvent me ) {
377- Log .i ("DoubleTap" , "Chart double-tapped." );
383+ Log .i ("DoubleTap" , "Chart double-tapped." );
378384 }
379385
380386 @ Override
381387 public void onChartSingleTapped (MotionEvent me ) {
382388 Log .i ("SingleTap" , "Chart single-tapped." );
383389 }
384-
390+
385391 @ Override
386392 public void onValueSelected (Entry e , int dataSetIndex ) {
387393 Log .i ("Entry selected" , e .toString ());
388394 }
389-
395+
390396 @ Override
391397 public void onNothingSelected () {
392398 Log .i ("Nothing selected" , "Nothing selected." );
0 commit comments