nus-yam/ex-repair huggingface dataset:
Program: 18896
Project: 18896
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_scatterchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(ScatterChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setTouchEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setDrawYValues(false);
  mChart.setDragEnabled(true);
  mChart.setMaxVisibleValueCount(200);
  mChart.setPinchZoom(true);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_scatterchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(ScatterChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setTouchEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setDrawYValues(false);
  mChart.setDragScaleEnabled(true);
  mChart.setMaxVisibleValueCount(200);
  mChart.setPinchZoom(true);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
}
Program: 18897
Project: 18897
Buggy source:
/** 
 * returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point.
 * @param x
 * @param y
 * @return
 */
public Highlight getHighlightByTouchPoint(float x,float y){
  float[] pts=new float[2];
  pts[0]=x;
  pts[1]=y;
  Matrix tmp=new Matrix();
  mMatrixOffset.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixTouch.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixValueToPx.invert(tmp);
  tmp.mapPoints(pts);
  double xTouchVal=pts[0];
  double yTouchVal=pts[1];
  double base=Math.floor(xTouchVal);
  double touchOffset=mDeltaX * 0.025;
  if ((this instanceof LineChart || this instanceof ScatterChart) && (xTouchVal < -touchOffset || xTouchVal > mDeltaX + touchOffset))   return null;
  if (this instanceof BarChart && (xTouchVal < 0 || xTouchVal > mDeltaX))   return null;
  if (base < 0)   base=0;
  if (base >= mDeltaX)   base=mDeltaX - 1;
  int xIndex=(int)base;
  int dataSetIndex=0;
  if (this instanceof LineChart || this instanceof ScatterChart) {
    if (xTouchVal - base > 0.5) {
      xIndex=(int)base + 1;
    }
  }
  if (mDataNotSet) {
    Log.i(LOG_TAG,"String_Node_Str");
    return null;
  }
  ArrayList<SelInfo> valsAtIndex=getYValsAtIndex(xIndex);
  dataSetIndex=getClosestDataSetIndex(valsAtIndex,(float)yTouchVal);
  if (dataSetIndex == -1)   return null;
  return new Highlight(xIndex,(float)yTouchVal,dataSetIndex);
}

Fixed version (ground truth):
/** 
 * returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point.
 * @param x
 * @param y
 * @return
 */
public Highlight getHighlightByTouchPoint(float x,float y){
  float[] pts=new float[2];
  pts[0]=x;
  pts[1]=y;
  Matrix tmp=new Matrix();
  mMatrixOffset.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixTouch.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixValueToPx.invert(tmp);
  tmp.mapPoints(pts);
  double xTouchVal=pts[0];
  double yTouchVal=pts[1];
  double base=Math.floor(xTouchVal);
  double touchOffset=mDeltaX * 0.025;
  if ((this instanceof LineChart || this instanceof ScatterChart) && (xTouchVal < -touchOffset || xTouchVal > mDeltaX + touchOffset))   return null;
  if (this instanceof BarChart && (xTouchVal < 0 || xTouchVal > mDeltaX))   return null;
  if (base < 0)   base=0;
  if (base >= mDeltaX)   base=mDeltaX - 1;
  int xIndex=(int)base;
  int dataSetIndex=0;
  if (this instanceof LineChart || this instanceof ScatterChart) {
    if (xTouchVal - base > 0.5) {
      xIndex=(int)base + 1;
    }
  }
  if (mDataNotSet) {
    Log.i(LOG_TAG,"String_Node_Str");
    return null;
  }
  ArrayList<SelInfo> valsAtIndex=getYValsAtIndex(xIndex);
  dataSetIndex=getClosestDataSetIndex(valsAtIndex,(float)yTouchVal);
  if (dataSetIndex == -1)   return null;
  return new Highlight(xIndex,dataSetIndex);
}
Program: 18898
Project: 18898
Buggy source:
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    if (xIndex < mCurrentData.getXVals().size() && xIndex < mDeltaX * mPhaseX)     drawMarkerView(xIndex,mIndicesToHightlight[i].getDataSetIndex());
  }
}

Fixed version (ground truth):
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mPhaseX)     drawMarkerView(xIndex,mIndicesToHightlight[i].getDataSetIndex());
  }
}
Program: 18899
Project: 18899
Buggy source:
/** 
 * Draws the view that is displayed when a value is highlighted.
 * @param xIndex the selected x-index
 * @param dataSetIndex the index of the selected DataSet
 */
private void drawMarkerView(int xIndex,int dataSetIndex){
  Entry e=getEntryByDataSetIndex(xIndex,dataSetIndex);
  if (e == null)   return;
  float xPos=(float)xIndex;
  if (this instanceof BarChart || this instanceof CandleStickChart)   xPos+=0.5f;
  float[] pts=new float[]{xPos,e.getVal() * mPhaseY};
  transformPointArray(pts);
  float posX=pts[0];
  float posY=pts[1];
  mMarkerView.refreshContent(e,dataSetIndex);
  mMarkerView.draw(mDrawCanvas,posX,posY);
}

Fixed version (ground truth):
/** 
 * Draws the view that is displayed when a value is highlighted.
 * @param xIndex the selected x-index
 * @param dataSetIndex the index of the selected DataSet
 */
private void drawMarkerView(int xIndex,int dataSetIndex){
  Entry e=getEntryByDataSetIndex(xIndex,dataSetIndex);
  if (e == null) {
    return;
  }
  float xPos=(float)xIndex;
  if (this instanceof BarChart || this instanceof CandleStickChart)   xPos+=0.5f;
  float[] pts=new float[]{xPos,e.getVal() * mPhaseY};
  transformPointArray(pts);
  float posX=pts[0];
  float posY=pts[1];
  mMarkerView.refreshContent(e,dataSetIndex);
  mMarkerView.draw(mDrawCanvas,posX,posY);
}
Program: 18900
Project: 18900
Buggy source:
/** 
 * Returns the first Entry object found at the given xIndex. Returns null if no Entry object at that index. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.
 * @param xIndex
 * @return
 */
public Entry getEntryForXIndex(int xIndex){
  for (int i=0; i < mYVals.size(); i++) {
    if (xIndex == mYVals.get(i).getXIndex())     return mYVals.get(i);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the first Entry object found at the given xIndex with binary search. Returns null if no Entry object at that index. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.
 * @param xIndex
 * @return
 */
public Entry getEntryForXIndex(int x){
  int low=0;
  int high=mYVals.size();
  while (low <= high) {
    int m=(high + low) / 2;
    if (x == mYVals.get(m).getXIndex()) {
      return mYVals.get(m);
    }
    if (x > mYVals.get(m).getXIndex())     low=m + 1;
 else     high=m - 1;
  }
  return null;
}
Program: 18902
Project: 18902
Buggy source:
@Override public boolean onSingleTapUp(MotionEvent e){
  float distance=mChart.distanceToCenter(e.getX(),e.getY());
  if (distance < mChart.getRadius() / 2 || distance > mChart.getRadius()) {
    mChart.highlightValues(null);
    mLastHighlight=null;
  }
 else {
    int index=mChart.getIndexForAngle(mChart.getAngleForPoint(e.getX(),e.getY()));
    int dataSetIndex=mChart.getDataSetIndexForIndex(index);
    Highlight h=new Highlight(index,0f,dataSetIndex);
    if (h.equalTo(mLastHighlight)) {
      mChart.highlightTouch(null);
      mLastHighlight=null;
    }
 else {
      mChart.highlightTouch(h);
      mLastHighlight=h;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onSingleTapUp(MotionEvent e){
  float distance=mChart.distanceToCenter(e.getX(),e.getY());
  if (distance < mChart.getRadius() / 2 || distance > mChart.getRadius()) {
    mChart.highlightValues(null);
    mLastHighlight=null;
  }
 else {
    int index=mChart.getIndexForAngle(mChart.getAngleForPoint(e.getX(),e.getY()));
    int dataSetIndex=mChart.getDataSetIndexForIndex(index);
    Highlight h=new Highlight(index,dataSetIndex);
    if (h.equalTo(mLastHighlight)) {
      mChart.highlightTouch(null);
      mLastHighlight=null;
    }
 else {
      mChart.highlightTouch(h);
      mLastHighlight=h;
    }
  }
  return true;
}
Program: 18903
Project: 18903
Buggy source:
/** 
 * constructor
 * @param x the index of the highlighted value on the x-axis
 * @param val the value at the position the user touched
 * @param dataSet the index of the DataSet the highlighted value belongs to
 */
public Highlight(int x,float val,int dataSet){
  this.mXIndex=x;
  this.mVal=val;
  this.mDataSetIndex=dataSet;
}

Fixed version (ground truth):
/** 
 * constructor
 * @param x the index of the highlighted value on the x-axis
 * @param val the value at the position the user touched
 * @param dataSet the index of the DataSet the highlighted value belongs to
 */
public Highlight(int x,int dataSet){
  this.mXIndex=x;
  this.mDataSetIndex=dataSet;
}
Program: 18904
Project: 18904
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(true);
  mChart.setDrawYValues(true);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setInvertYAxisEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(25,50);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(true);
  mChart.setDrawYValues(true);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setInvertYAxisEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  XLabels xl=mChart.getXLabels();
  xl.setAvoidFirstLastClipping(true);
  setData(25,50);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}
Program: 18905
Project: 18905
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.5f);
  set1.setCircleSize(4f);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i % 30) + "String_Node_Str" + (i % 12)+ "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.5f);
  set1.setCircleSize(4f);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
}
Program: 18906
Project: 18906
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setHoleRadius(60f);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawYValues(true);
  mChart.setDrawCenterText(true);
  mChart.setDrawHoleEnabled(true);
  mChart.setDrawXValues(true);
  mChart.setTouchEnabled(true);
  mChart.setUsePercentValues(true);
  mChart.setOnChartValueSelectedListener(this);
  mSeekBarX.setProgress(3);
  mSeekBarY.setProgress(100);
  mChart.animateXY(1500,1500);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setHoleRadius(60f);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawYValues(true);
  mChart.setDrawCenterText(true);
  mChart.setDrawHoleEnabled(true);
  mChart.setDrawXValues(true);
  mChart.setUsePercentValues(true);
  mChart.setOnChartValueSelectedListener(this);
  mSeekBarX.setProgress(3);
  mSeekBarY.setProgress(100);
  mChart.animateXY(1500,1500);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}
Program: 18907
Project: 18907
Buggy source:
/** 
 * draws the x-labels on the specified y-position
 * @param yPos
 */
private void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=0.5f;
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight) {
      mDrawCanvas.drawText(mCurrentData.getXVals().get(i),position[0],yPos,mXLabelPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the x-labels on the specified y-position
 * @param yPos
 */
private void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=0.5f;
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight) {
      String label=mCurrentData.getXVals().get(i);
      if (mXLabels.isAvoidFirstLastClippingEnabled()) {
        if (i == mCurrentData.getXValCount() - 1) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          if (width > getOffsetRight() * 2 && position[0] + width > getWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          position[0]+=width / 2;
        }
      }
      mDrawCanvas.drawText(label,position[0],yPos,mXLabelPaint);
    }
  }
}
Program: 18908
Project: 18908
Buggy source:
@Override protected void drawData(){
}

Fixed version (ground truth):
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=(ArrayList<CandleDataSet>)mCurrentData.getDataSets();
  mRenderPaint.setStyle(Paint.Style.STROKE);
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<? extends Entry> entries=dataSet.getYVals();
    float[] valuePoints=generateTransformedValues(entries,0f);
    for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
      mRenderPaint.setColor(dataSet.getColor(j / 2));
      if (isOffContentRight(valuePoints[j]))       break;
      if (j != 0 && isOffContentLeft(valuePoints[j - 1]) && isOffContentTop(valuePoints[j + 1]) && isOffContentBottom(valuePoints[j + 1]))       continue;
      mDrawCanvas.drawLine(valuePoints[j],valuePoints[j + 1],valuePoints[j + 2],valuePoints[j + 3],mRenderPaint);
    }
  }
}
Program: 18909
Project: 18909
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  return mListener.onTouch(this,event);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (mTouchEnabled && mListener != null)   return mListener.onTouch(this,event);
 else   return super.onTouchEvent(event);
}
Program: 18910
Project: 18910
Buggy source:
@Override protected void init(){
  super.init();
  mFilledPaint=new Paint();
  mFilledPaint.setStyle(Paint.Style.FILL);
  mFilledPaint.setColor(mColorDarkBlue);
  mFilledPaint.setAlpha(130);
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}

Fixed version (ground truth):
@Override protected void init(){
  super.init();
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}
Program: 18913
Project: 18913
Buggy source:
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals1.add(new Entry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.random() * mult) - 50;
    yVals1.add(new Entry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
  mChart.invalidate();
}
Program: 18914
Project: 18914
Buggy source:
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  if (!mStartAtZero && getYMin() >= 0f) {
    mYChartMin=getYMin();
    mDeltaY=Math.abs(mYChartMax - mYChartMin);
  }
  mDeltaX++;
}

Fixed version (ground truth):
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  mDeltaX++;
}
Program: 18915
Project: 18915
Buggy source:
@Override protected void drawHighlights(){
  if (mHighlightEnabled && mHighLightIndicatorEnabled && valuesToHighlight()) {
    float offsetY=mDeltaY * 0.04f;
    for (int i=0; i < mIndicesToHightlight.length; i++) {
      Highlight h=mIndicesToHightlight[i];
      int index=h.getXIndex();
      int dataSetIndex=h.getDataSetIndex();
      BarDataSet ds=(BarDataSet)mCurrentData.getDataSetByIndex(dataSetIndex);
      if (index < mCurrentData.getYValCount() && index >= 0 && index < mDeltaX * mPhaseX) {
        mHighlightPaint.setAlpha(120);
        Entry e=getEntryByDataSetIndex(index,dataSetIndex);
        float y=e.getSum() * mPhaseY;
        float top=y >= 0 ? y : 0;
        float bottom=y <= 0 ? y : 0;
        float left=index + ds.getBarSpace() / 2f;
        float right=index + 1f - ds.getBarSpace() / 2f;
        RectF highlight=new RectF(left,top,right,bottom);
        transformRect(highlight);
        mDrawCanvas.drawRect(highlight,mHighlightPaint);
        if (mDrawHighlightArrow) {
          mHighlightPaint.setAlpha(200);
          Path arrow=new Path();
          arrow.moveTo(index + 0.5f,y + offsetY * 0.3f);
          arrow.lineTo(index + 0.2f,y + offsetY);
          arrow.lineTo(index + 0.8f,y + offsetY);
          transformPath(arrow);
          mDrawCanvas.drawPath(arrow,mHighlightPaint);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void drawHighlights(){
  if (mHighlightEnabled && mHighLightIndicatorEnabled && valuesToHighlight()) {
    for (int i=0; i < mIndicesToHightlight.length; i++) {
      Highlight h=mIndicesToHightlight[i];
      int index=h.getXIndex();
      int dataSetIndex=h.getDataSetIndex();
      BarDataSet ds=(BarDataSet)mCurrentData.getDataSetByIndex(dataSetIndex);
      if (index < mCurrentData.getYValCount() && index >= 0 && index < mDeltaX * mPhaseX) {
        mHighlightPaint.setAlpha(120);
        Entry e=getEntryByDataSetIndex(index,dataSetIndex);
        prepareBar(e.getXIndex(),e.getSum(),ds.getBarSpace());
        mDrawCanvas.drawRect(mBarRect,mHighlightPaint);
      }
    }
  }
}
Program: 18916
Project: 18916
Buggy source:
/** 
 * Prepares a bar for drawing on the specified x-index and y-position. Also prepares the shadow-bar if enabled.
 * @param x the x-position
 * @param y the y-position
 * @param space the space between bars
 */
private void prepareBar(float x,float y,float space){
  float left=x + space / 2f;
  float right=x + 1f - space / 2f;
  float top=(y >= 0 ? y : 0) * mPhaseY;
  float bottom=(y <= 0 ? y : 0) * mPhaseY;
  mBarRect.set(left,top,right,bottom);
  transformRect(mBarRect);
  if (mDrawBarShadow) {
    mBarShadow.set(mBarRect.left,mOffsetTop,mBarRect.right,getHeight() - mOffsetBottom);
  }
}

Fixed version (ground truth):
/** 
 * Prepares a bar for drawing on the specified x-index and y-position. Also prepares the shadow-bar if enabled.
 * @param x the x-position
 * @param y the y-position
 * @param space the space between bars
 */
private void prepareBar(float x,float y,float space){
  float spaceHalf=space / 2f;
  float left=x + spaceHalf;
  float right=x + 1f - spaceHalf;
  float top=y >= 0 ? y : 0;
  float bottom=y <= 0 ? y : 0;
  mBarRect.set(left,top,right,bottom);
  transformRectWithPhase(mBarRect);
  if (mDrawBarShadow) {
    mBarShadow.set(mBarRect.left,mOffsetTop,mBarRect.right,getHeight() - mOffsetBottom);
  }
}
Program: 18917
Project: 18917
Buggy source:
/** 
 * draws the y-labels on the specified x-position
 * @param xPos
 * @param positions
 */
private void drawYLabels(float xPos,float[] positions){
  for (int i=0; i < mYLabels.mEntryCount; i++) {
    String text=Utils.formatNumber(mYLabels.mEntries[i],mYLabels.mDecimals,mSeparateTousands);
    if (!mYLabels.isDrawTopYLabelEntryEnabled() && i >= mYLabels.mEntryCount - 1)     return;
    if (mYLabels.isDrawUnitsInYLabelEnabled()) {
      mDrawCanvas.drawText(text + mUnit,xPos,positions[i * 2 + 1],mYLabelPaint);
    }
 else {
      mDrawCanvas.drawText(text,xPos,positions[i * 2 + 1],mYLabelPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the y-labels on the specified x-position
 * @param xPos
 * @param positions
 */
private void drawYLabels(float xPos,float[] positions,float yOffset){
  for (int i=0; i < mYLabels.mEntryCount; i++) {
    String text=Utils.formatNumber(mYLabels.mEntries[i],mYLabels.mDecimals,mSeparateTousands);
    if (!mYLabels.isDrawTopYLabelEntryEnabled() && i >= mYLabels.mEntryCount - 1)     return;
    if (mYLabels.isDrawUnitsInYLabelEnabled()) {
      mDrawCanvas.drawText(text + mUnit,xPos,positions[i * 2 + 1] + yOffset,mYLabelPaint);
    }
 else {
      mDrawCanvas.drawText(text,xPos,positions[i * 2 + 1] + yOffset,mYLabelPaint);
    }
  }
}
Program: 18918
Project: 18918
Buggy source:
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  float space=mDeltaY / 100f * 15f;
  if (mStartAtZero) {
    mYChartMin=0;
  }
 else {
    mYChartMin=mYChartMin - space;
  }
  mYChartMax=mYChartMax + space;
  mDeltaY=Math.abs(mYChartMax - mYChartMin);
}

Fixed version (ground truth):
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  float space=Math.abs(mDeltaY / 100f * 15f);
  if (mStartAtZero) {
    if (mYChartMax < 0) {
      mYChartMax=0;
      mYChartMin=mYChartMin - space;
    }
 else {
      mYChartMin=0;
      mYChartMax=mYChartMax + space;
    }
  }
 else {
    mYChartMin=mYChartMin - space / 2f;
    mYChartMax=mYChartMax + space / 2f;
  }
  mDeltaY=Math.abs(mYChartMax - mYChartMin);
}
Program: 18919
Project: 18919
Buggy source:
private Path generateFilledPath(ArrayList<Entry> entries){
  Path filled=new Path();
  filled.moveTo(entries.get(0).getXIndex(),entries.get(0).getVal() * mPhaseY);
  for (int x=1; x < entries.size() * mPhaseX; x++) {
    Entry e=entries.get(x);
    filled.lineTo(e.getXIndex(),e.getVal() * mPhaseY);
  }
  filled.lineTo(entries.get((int)((entries.size() - 1) * mPhaseX)).getXIndex(),mYChartMin);
  filled.lineTo(entries.get(0).getXIndex(),mYChartMin);
  filled.close();
  return filled;
}

Fixed version (ground truth):
/** 
 * Generates the path that is used for filled drawing.
 * @param entries
 * @return
 */
private Path generateFilledPath(ArrayList<Entry> entries){
  Path filled=new Path();
  filled.moveTo(entries.get(0).getXIndex(),entries.get(0).getVal() * mPhaseY);
  for (int x=1; x < entries.size() * mPhaseX; x++) {
    Entry e=entries.get(x);
    filled.lineTo(e.getXIndex(),e.getVal() * mPhaseY);
  }
  filled.lineTo(entries.get((int)((entries.size() - 1) * mPhaseX)).getXIndex(),mYChartMin);
  filled.lineTo(entries.get(0).getXIndex(),mYChartMin);
  filled.close();
  return filled;
}
Program: 18920
Project: 18920
Buggy source:
@Override protected void drawValues(){
  if (mDrawYValues && mCurrentData.getYValCount() < mMaxVisibleCount * mScaleX) {
    ArrayList<ScatterDataSet> dataSets=(ArrayList<ScatterDataSet>)mCurrentData.getDataSets();
    for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      ArrayList<Entry> entries=dataSet.getYVals();
      float[] positions=generateTransformedValues(entries,0f);
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length; j+=2) {
        if (isOffContentRight(positions[j]))         break;
        if (isOffContentLeft(positions[j]) || isOffContentTop(positions[j + 1]) || isOffContentBottom(positions[j + 1]))         continue;
        float val=entries.get(j / 2).getVal();
        if (mDrawUnitInChart) {
          mDrawCanvas.drawText(mFormatValue.format(val) + mUnit,positions[j],positions[j + 1] - shapeSize,mValuePaint);
        }
 else {
          mDrawCanvas.drawText(mFormatValue.format(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void drawValues(){
  if (mDrawYValues && mCurrentData.getYValCount() < mMaxVisibleCount * mScaleX) {
    ArrayList<ScatterDataSet> dataSets=(ArrayList<ScatterDataSet>)mCurrentData.getDataSets();
    for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      ArrayList<Entry> entries=dataSet.getYVals();
      float[] positions=generateTransformedValues(entries,0f);
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length * mPhaseX; j+=2) {
        if (isOffContentRight(positions[j]))         break;
        if (isOffContentLeft(positions[j]) || isOffContentTop(positions[j + 1]) || isOffContentBottom(positions[j + 1]))         continue;
        float val=entries.get(j / 2).getVal();
        if (mDrawUnitInChart) {
          mDrawCanvas.drawText(mFormatValue.format(val) + mUnit,positions[j],positions[j + 1] - shapeSize,mValuePaint);
        }
 else {
          mDrawCanvas.drawText(mFormatValue.format(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
        }
      }
    }
  }
}
Program: 18921
Project: 18921
Buggy source:
@Override public Fragment getItem(int pos){
  Fragment f=null;
switch (pos) {
case 0:
    f=LineChartFrag.newInstance();
  break;
case 1:
f=BarChartFrag.newInstance();
break;
case 2:
f=ScatterChartFrag.newInstance();
break;
case 3:
f=PieChartFrag.newInstance();
break;
}
return f;
}

Fixed version (ground truth):
@Override public Fragment getItem(int pos){
  Fragment f=null;
switch (pos) {
case 0:
    f=SineCosineFragment.newInstance();
  break;
case 1:
f=ComplexityFragment.newInstance();
break;
case 2:
f=BarChartFrag.newInstance();
break;
case 3:
f=ScatterChartFrag.newInstance();
break;
case 4:
f=PieChartFrag.newInstance();
break;
}
return f;
}
Program: 18922
Project: 18922
Buggy source:
@Override public int getCount(){
  return 4;
}

Fixed version (ground truth):
@Override public int getCount(){
  return 5;
}
Program: 18924
Project: 18924
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(false);
  mChart.setDrawYValues(false);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(45,100);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(false);
  mChart.setDrawYValues(false);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(45,100);
  mChart.animateX(2500);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}
Program: 18925
Project: 18925
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f);
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  LimitLine ll2=new LimitLine(-30f);
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  data.addLimitLine(ll1);
  data.addLimitLine(ll2);
  mChart.setData(data);
}
Program: 18926
Project: 18926
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_listview_chart);
  ListView lv=(ListView)findViewById(R.id.listView1);
  ArrayList<ChartData> list=new ArrayList<ChartData>();
  for (int i=0; i < 20; i++) {
    list.add(generateData(i + 1));
  }
  ChartDataAdapter cda=new ChartDataAdapter(getApplicationContext(),list);
  lv.setAdapter(cda);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_listview_chart);
  ListView lv=(ListView)findViewById(R.id.listView1);
  ArrayList<BarData> list=new ArrayList<BarData>();
  for (int i=0; i < 20; i++) {
    list.add(generateData(i + 1));
  }
  ChartDataAdapter cda=new ChartDataAdapter(getApplicationContext(),list);
  lv.setAdapter(cda);
}
Program: 18927
Project: 18927
Buggy source:
public ChartDataAdapter(Context context,List<ChartData> objects){
  super(context,0,objects);
  mTf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
}

Fixed version (ground truth):
public ChartDataAdapter(Context context,List<BarData> objects){
  super(context,0,objects);
  mTf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
}
Program: 18928
Project: 18928
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ChartData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}
Program: 18929
Project: 18929
Buggy source:
protected ChartData generateBarData(int dataSets,float range,int count){
  ArrayList<BarDataSet> sets=new ArrayList<BarDataSet>();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    BarDataSet ds=new BarDataSet(entries,getLabel(i));
    ds.setColors(ColorTemplate.VORDIPLOM_COLORS,getActivity());
    sets.add(ds);
  }
  BarData d=new BarData(ChartData.generateXVals(0,count),sets);
  return d;
}

Fixed version (ground truth):
protected BarData generateBarData(int dataSets,float range,int count){
  ArrayList<BarDataSet> sets=new ArrayList<BarDataSet>();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    BarDataSet ds=new BarDataSet(entries,getLabel(i));
    ds.setColors(ColorTemplate.VORDIPLOM_COLORS,getActivity());
    sets.add(ds);
  }
  BarData d=new BarData(ChartData.generateXVals(0,count),sets);
  return d;
}
Program: 18930
Project: 18930
Buggy source:
protected ChartData generateScatterData(int dataSets,float range,int count){
  ArrayList<ScatterDataSet> sets=new ArrayList<ScatterDataSet>();
  ScatterShape[] shapes=ScatterChart.getAllPossibleShapes();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    ScatterDataSet ds=new ScatterDataSet(entries,getLabel(i));
    ds.setScatterShapeSize(12f);
    ds.setScatterShape(shapes[i % shapes.length]);
    ds.setColors(ColorTemplate.COLORFUL_COLORS,getActivity());
    ds.setScatterShapeSize(9f);
    sets.add(ds);
  }
  ScatterData d=new ScatterData(ChartData.generateXVals(0,count),sets);
  return d;
}

Fixed version (ground truth):
protected ScatterData generateScatterData(int dataSets,float range,int count){
  ArrayList<ScatterDataSet> sets=new ArrayList<ScatterDataSet>();
  ScatterShape[] shapes=ScatterChart.getAllPossibleShapes();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    ScatterDataSet ds=new ScatterDataSet(entries,getLabel(i));
    ds.setScatterShapeSize(12f);
    ds.setScatterShape(shapes[i % shapes.length]);
    ds.setColors(ColorTemplate.COLORFUL_COLORS,getActivity());
    ds.setScatterShapeSize(9f);
    sets.add(ds);
  }
  ScatterData d=new ScatterData(ChartData.generateXVals(0,count),sets);
  return d;
}
Program: 18931
Project: 18931
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(mChartData);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((BarData)mChartData);
  holder.chart.animateY(700);
  return convertView;
}
Program: 18932
Project: 18932
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_linechart,null);
    holder.chart=(LineChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setDrawYValues(false);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(mChartData);
  holder.chart.animateX(1000);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_linechart,null);
    holder.chart=(LineChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setDrawYValues(false);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((LineData)mChartData);
  holder.chart.animateX(1000);
  return convertView;
}