Buggy code:
tvNoData = ( ( TextView ) ( findViewById ( txtNoData ) ) ) ; ArrayList < Record > recordList = db . getAllRecord ( 1 ) ; if ( ! ( recordList . isEmpty ( ) ) ) { tvNoData . setVisibility ( INVISIBLE ) ; Number [ ] years = new Integer [ recordList . size ( ) ] ; Number [ ] numSightings = new Integer [ recordList . size ( ) ] ; for ( int i = 0 ; i < ( recordList . size ( ) ) ; i ++ ) { years [ i ] = Integer . parseInt ( recordList . get ( i ) . getDate ( ) ) ; numSightings [ i ] = ( ( int ) ( Bmi . convertWeight ( getApplicationContext ( ) , recordList . get ( i ) . getWeight ( ) ) ) ) ; testMinMax ( ( ( int ) ( numSightings [ i ] ) ) ) ; } XYSeries series2 = new SimpleXYSeries ( Arrays . asList ( years ) , Arrays . asList ( numSightings ) , "User" ) ; LineAndPointFormatter formatter = new LineAndPointFormatter ( Color . rgb ( 0 , 0 , 0 ) , Color . BLUE , null , null ) ; plot1 . addSeries ( series2 , formatter ) ; plot1 . setDomainStep ( SUBDIVIDE , ( ( years . length ) // 2 ) ) ; } else { plot1 . setVisibility ( INVISIBLE ) ; button . setVisibility ( INVISIBLE ) ; tvNoData . setVisibility ( VISIBLE ) ; } Goal userGoal = db . viewGoal ( 1 ) ; if ( ( userGoal . getTarget_date ( ) ) != null ) { Number [ ] goalYears = new Integer [ 2 ] ; Number [ ] goalWeight = new Integer [ 2 ] ; goalYears [ 0 ] = Integer . parseInt ( userGoal . getStart_date ( ) ) ; goalYears [ 1 ] = Integer . parseInt ( userGoal . getTarget_date ( ) ) ; goalWeight [ 0 ] = ( ( int ) ( Bmi . convertWeight ( getApplicationContext ( ) , userGoal . getStart_weight ( ) ) ) ) ; goalWeight [ 1 ] = ( ( int ) ( Bmi . convertWeight ( getApplicationContext ( ) , userGoal . getTarget_weight ( ) ) ) ) ; testMinMax ( ( ( int ) ( goalWeight [ 1 ] ) ) ) ; XYSeries goalSeries = new SimpleXYSeries ( Arrays . asList ( goalYears ) , Arrays . asList ( goalWeight ) , "Goal" ) ; LineAndPointFormatter formatter2 = new LineAndPointFormatter ( Color . rgb ( 255 , 0 , 0 ) , Color . RED , null , null ) ; plot1 . addSeries ( goalSeries , formatter2 ) ; } plot1 . getGraphWidget ( ) . getGridBackgroundPaint ( ) . setColor ( WHITE ) ; plot1 . getGraphWidget ( ) . getDomainGridLinePaint ( ) . setColor ( BLACK ) ; plot1 . getGraphWidget ( ) . getDomainGridLinePaint ( ) . setPathEffect ( new DashPathEffect ( new float [ ] { 1 , 1 } , 1 ) ) ; plot1 . getGraphWidget ( ) . getRangeGridLinePaint ( ) . setColor ( BLACK ) ; plot1 . getGraphWidget ( ) . getRangeGridLinePaint ( ) . setPathEffect ( new DashPathEffect ( new float [ ] { 1 , 1 } , 1 ) ) ; plot1 . getGraphWidget ( ) . getDomainOriginLinePaint ( ) . setColor ( BLACK ) ; plot1 . getGraphWidget ( ) . getRangeOriginLinePaint ( ) . setColor ( BLACK ) ; LineAndPointFormatter series1Format = new LineAndPointFormatter ( Color . rgb ( 0 , 100 , 0 ) , Color . rgb ( 0 , 100 , 0 ) , Color . rgb ( 100 , 200 , 0 ) , null ) ; Paint lineFill = new Paint ( ) ; lineFill . setAlpha ( 200 ) ; lineFill . setShader ( new android . graphics . LinearGradient ( 0 , 0 , 200 , 200 , Color . WHITE , Color . WHITE , TileMode . CLAMP ) ) ; plot1 . getGraphWidget ( ) . setPaddingRight ( 2 ) ; plot1 . setRangeBoundaries ( ( ( minWeight ) - 3 ) , ( ( maxWeight ) + 3 ) , FIXED ) ; <START_BUG> plot1 . setDomainLabel ( "Year" ) ; <END_BUG> plot1 . setRangeLabel ( "Weight" ) ; plot1 . setRangeValueFormat ( new DecimalFormat ( "1" ) ) ; plot1 . setDomainValueFormat ( new Format ( ) { private SimpleDateFormat dateFormat = new SimpleDateFormat ( "MMM-yyyy" ) ; @ Override public StringBuffer format ( Object obj , StringBuffer toAppendTo , FieldPosition pos ) { long timestamp = ( ( ( Number ) ( obj ) ) . longValue ( ) ) * 1000 ; Date date = new Date ( timestamp ) ; return dateFormat . format ( date , toAppendTo , pos ) ; } @ Override public Object parseObject ( String source , ParsePosition pos ) { return null ; } } ) ; button . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { new android . app . AlertDialog . Builder ( v . getContext ( ) ) . setTitle ( "Clear<seq2seq4repair_space>History" ) . setMessage ( "It<seq2seq4repair_space>will<seq2seq4repair_space>delete<seq2seq4repair_space>all<seq2seq4repair_space>stored<seq2seq4repair_space>information.<seq2seq4repair_space>Continue?" ) . setPositiveButton ( yes , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { plot1 . clear ( ) ; plot1 . redraw ( ) ; db . deleteAllRecord ( ) ; } } ) . setNegativeButton ( no , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { } } ) . setIcon ( ic_dialog_alert ) . show ( ) ; } } ) ; } private void testMinMax ( int value ) { }

Fix:
plot1 . setDomainLabel ( "Date" ) ;