nus-yam/ex-repair huggingface dataset:
Program: 26676
Project: 26676
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.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  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=10; i < count - 10; 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.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.setData(data);
}
Program: 26677
Project: 26677
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawData(canvas);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
}
Program: 26678
Project: 26678
Buggy source:
protected void drawDataSet(Canvas c,BarDataSet dataSet,int index){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  calcXBounds(trans);
  mShadowPaint.setColor(dataSet.getBarShadowColor());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  ArrayList<BarEntry> entries=dataSet.getYVals();
  BarBuffer buffer=mBarBuffers[index];
  buffer.setPhases(phaseX,phaseY);
  buffer.setBarSpace(dataSet.getBarSpace());
  buffer.setDataSet(index);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  for (int j=0; j < buffer.size(); j+=4) {
    if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))     continue;
    if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))     break;
    if (mChart.isDrawBarShadowEnabled()) {
      c.drawRect(buffer.buffer[j],mViewPortHandler.contentTop(),buffer.buffer[j + 2],mViewPortHandler.contentBottom(),mShadowPaint);
    }
    mRenderPaint.setColor(dataSet.getColor(j / 4));
    c.drawRect(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
  }
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,BarDataSet dataSet,int index){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  calcXBounds(trans);
  mShadowPaint.setColor(dataSet.getBarShadowColor());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  ArrayList<BarEntry> entries=dataSet.getYVals();
  BarBuffer buffer=mBarBuffers[index];
  buffer.setPhases(phaseX,phaseY);
  buffer.setBarSpace(dataSet.getBarSpace());
  buffer.setDataSet(index);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  if (dataSet.getColors().size() > 1) {
    for (int j=0; j < buffer.size(); j+=4) {
      if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))       continue;
      if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))       break;
      if (mChart.isDrawBarShadowEnabled()) {
        c.drawRect(buffer.buffer[j],mViewPortHandler.contentTop(),buffer.buffer[j + 2],mViewPortHandler.contentBottom(),mShadowPaint);
      }
      mRenderPaint.setColor(dataSet.getColor(j / 4));
      c.drawRect(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    mRenderPaint.setColor(dataSet.getColor());
    for (int j=0; j < buffer.size(); j+=4) {
      if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))       continue;
      if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))       break;
      if (mChart.isDrawBarShadowEnabled()) {
        c.drawRect(buffer.buffer[j],mViewPortHandler.contentTop(),buffer.buffer[j + 2],mViewPortHandler.contentBottom(),mShadowPaint);
      }
      c.drawRect(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
}
Program: 26679
Project: 26679
Buggy source:
@Override public void drawData(Canvas c){
  if (mPathBitmap == null) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mPathCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  if (mPathBitmap == null) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}
Program: 26680
Project: 26680
Buggy source:
protected void drawCubicFill(Canvas c,LineDataSet dataSet,Path spline,Transformer trans,int from,int to){
  float fillMin=mChart.getFillFormatter().getFillLinePosition(dataSet,mChart.getLineData(),mChart.getYChartMax(),mChart.getYChartMin());
  Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
  Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
  spline.lineTo(entryTo.getXIndex(),fillMin);
  spline.lineTo(entryFrom.getXIndex(),fillMin);
  spline.close();
  mRenderPaint.setStyle(Paint.Style.FILL);
  mRenderPaint.setColor(dataSet.getFillColor());
  mRenderPaint.setAlpha(dataSet.getFillAlpha());
  trans.pathValueToPixel(spline);
  mPathCanvas.drawPath(spline,mRenderPaint);
  mRenderPaint.setAlpha(255);
}

Fixed version (ground truth):
protected void drawCubicFill(Canvas c,LineDataSet dataSet,Path spline,Transformer trans,int from,int to){
  float fillMin=mChart.getFillFormatter().getFillLinePosition(dataSet,mChart.getLineData(),mChart.getYChartMax(),mChart.getYChartMin());
  Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
  Entry entryTo=dataSet.getEntryForXIndex(mMaxX + 1);
  spline.lineTo(entryTo.getXIndex(),fillMin);
  spline.lineTo(entryFrom.getXIndex(),fillMin);
  spline.close();
  mRenderPaint.setStyle(Paint.Style.FILL);
  mRenderPaint.setColor(dataSet.getFillColor());
  mRenderPaint.setAlpha(dataSet.getFillAlpha());
  trans.pathValueToPixel(spline);
  mBitmapCanvas.drawPath(spline,mRenderPaint);
  mRenderPaint.setAlpha(255);
}
Program: 26682
Project: 26682
Buggy source:
@Override public void drawData(Canvas c){
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  if (mDrawBitmap == null) {
    mDrawBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mDrawBitmap,0,0,mRenderPaint);
}
Program: 26683
Project: 26683
Buggy source:
protected void drawDataSet(Canvas c,PieDataSet dataSet){
  float angle=mChart.getRotationAngle();
  int cnt=0;
  ArrayList<Entry> entries=dataSet.getYVals();
  float[] drawAngles=mChart.getDrawAngles();
  for (int j=0; j < entries.size(); j++) {
    float newangle=drawAngles[cnt];
    float sliceSpace=dataSet.getSliceSpace();
    Entry e=entries.get(j);
    if ((Math.abs(e.getVal()) > 0.000001)) {
      if (!mChart.needsHighlight(e.getXIndex(),mChart.getData().getIndexOfDataSet(dataSet))) {
        mRenderPaint.setColor(dataSet.getColor(j));
        c.drawArc(mChart.getCircleBox(),angle + sliceSpace / 2f,newangle * mAnimator.getPhaseY() - sliceSpace / 2f,true,mRenderPaint);
      }
    }
    angle+=newangle * mAnimator.getPhaseX();
    cnt++;
  }
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,PieDataSet dataSet){
  float angle=mChart.getRotationAngle();
  int cnt=0;
  ArrayList<Entry> entries=dataSet.getYVals();
  float[] drawAngles=mChart.getDrawAngles();
  for (int j=0; j < entries.size(); j++) {
    float newangle=drawAngles[cnt];
    float sliceSpace=dataSet.getSliceSpace();
    Entry e=entries.get(j);
    if ((Math.abs(e.getVal()) > 0.000001)) {
      if (!mChart.needsHighlight(e.getXIndex(),mChart.getData().getIndexOfDataSet(dataSet))) {
        mRenderPaint.setColor(dataSet.getColor(j));
        mBitmapCanvas.drawArc(mChart.getCircleBox(),angle + sliceSpace / 2f,newangle * mAnimator.getPhaseY() - sliceSpace / 2f,true,mRenderPaint);
      }
    }
    angle+=newangle * mAnimator.getPhaseX();
    cnt++;
  }
}
Program: 26684
Project: 26684
Buggy source:
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    int color=mHolePaint.getColor();
    c.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
    if (transparentCircleRadius > holeRadius) {
      mHolePaint.setColor(color & 0x60FFFFFF);
      c.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mHolePaint);
      mHolePaint.setColor(color);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    int color=mHolePaint.getColor();
    mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
    if (transparentCircleRadius > holeRadius) {
      mHolePaint.setColor(color & 0x60FFFFFF);
      mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mHolePaint);
      mHolePaint.setColor(color);
    }
  }
}
Program: 26686
Project: 26686
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float rotationAngle=mChart.getRotationAngle();
  float angle=0f;
  float[] drawAngles=mChart.getDrawAngles();
  float[] absoluteAngles=mChart.getAbsoluteAngles();
  for (int i=0; i < indices.length; i++) {
    int xIndex=indices[i].getXIndex();
    if (xIndex >= drawAngles.length)     continue;
    if (xIndex == 0)     angle=rotationAngle;
 else     angle=rotationAngle + absoluteAngles[xIndex - 1];
    angle*=mAnimator.getPhaseY();
    float sliceDegrees=drawAngles[xIndex];
    PieDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null)     continue;
    float shift=set.getSelectionShift();
    RectF circleBox=mChart.getCircleBox();
    RectF highlighted=new RectF(circleBox.left - shift,circleBox.top - shift,circleBox.right + shift,circleBox.bottom + shift);
    mRenderPaint.setColor(set.getColor(xIndex));
    c.drawArc(highlighted,angle + set.getSliceSpace() / 2f,sliceDegrees - set.getSliceSpace() / 2f,true,mRenderPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float rotationAngle=mChart.getRotationAngle();
  float angle=0f;
  float[] drawAngles=mChart.getDrawAngles();
  float[] absoluteAngles=mChart.getAbsoluteAngles();
  for (int i=0; i < indices.length; i++) {
    int xIndex=indices[i].getXIndex();
    if (xIndex >= drawAngles.length)     continue;
    if (xIndex == 0)     angle=rotationAngle;
 else     angle=rotationAngle + absoluteAngles[xIndex - 1];
    angle*=mAnimator.getPhaseY();
    float sliceDegrees=drawAngles[xIndex];
    PieDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null)     continue;
    float shift=set.getSelectionShift();
    RectF circleBox=mChart.getCircleBox();
    RectF highlighted=new RectF(circleBox.left - shift,circleBox.top - shift,circleBox.right + shift,circleBox.bottom + shift);
    mRenderPaint.setColor(set.getColor(xIndex));
    mBitmapCanvas.drawArc(highlighted,angle + set.getSliceSpace() / 2f,sliceDegrees - set.getSliceSpace() / 2f,true,mRenderPaint);
  }
}
Program: 26688
Project: 26688
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}

Fixed version (ground truth):
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}
Program: 26690
Project: 26690
Buggy source:
@Override protected void drawValue(Canvas c,float val,float xPos,float yPos,ValueFormatter formatter){
  super.drawValue(c,val,xPos + xOffset,yPos + yOffset,formatter);
}

Fixed version (ground truth):
@Override protected void drawValue(Canvas c,float val,float xPos,float yPos,ValueFormatter formatter){
  super.drawValue(c,val,xPos,yPos + mYOffset,formatter);
}
Program: 26691
Project: 26691
Buggy source:
public HorizontalBarChartRenderer(BarDataProvider chart,ChartAnimator animator,ViewPortHandler viewPortHandler){
  super(chart,animator,viewPortHandler);
  mValuePaint.setTextAlign(Align.LEFT);
  yOffset=Utils.calcTextHeight(mValuePaint,"String_Node_Str");
  xOffset=Utils.convertDpToPixel(4f);
}

Fixed version (ground truth):
public HorizontalBarChartRenderer(BarDataProvider chart,ChartAnimator animator,ViewPortHandler viewPortHandler){
  super(chart,animator,viewPortHandler);
  mValuePaint.setTextAlign(Align.LEFT);
}
Program: 26694
Project: 26694
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_barchart);
  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=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setDrawValuesForWholeStack(true);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  YAxis yLabels=mChart.getAxisLeft();
  yLabels.setLabelCount(5);
  yLabels.setValueFormatter(new MyValueFormatter());
  mChart.getAxisRight().setValueFormatter(new MyValueFormatter());
  XAxis xLabels=mChart.getXAxis();
  xLabels.setPosition(XAxisPosition.TOP);
  mSeekBarX.setProgress(12);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
  l.setFormSize(8f);
  l.setFormToTextSpace(4f);
  l.setXEntrySpace(6f);
}

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_barchart);
  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=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setDrawValuesForWholeStack(true);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawValueAboveBar(false);
  YAxis yLabels=mChart.getAxisLeft();
  yLabels.setLabelCount(5);
  yLabels.setValueFormatter(new MyValueFormatter());
  mChart.getAxisRight().setValueFormatter(new MyValueFormatter());
  XAxis xLabels=mChart.getXAxis();
  xLabels.setPosition(XAxisPosition.TOP);
  mSeekBarX.setProgress(12);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
  l.setFormSize(8f);
  l.setFormToTextSpace(4f);
  l.setXEntrySpace(6f);
}
Program: 26695
Project: 26695
Buggy source:
public float getBelowSum(int stackIndex){
  if (mVals == null)   return 0;
  float remainder=0f;
  int index=mVals.length - 1;
  while (index > stackIndex) {
    remainder+=mVals[index];
    index--;
  }
  return remainder;
}

Fixed version (ground truth):
public float getBelowSum(int stackIndex){
  if (mVals == null)   return 0;
  float remainder=0f;
  int index=mVals.length - 1;
  while (index > stackIndex && index >= 0) {
    remainder+=mVals[index];
    index--;
  }
  return remainder;
}
Program: 26697
Project: 26697
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_barchart);
  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=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setDrawValuesForWholeStack(true);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  YAxis yLabels=mChart.getAxisLeft();
  yLabels.setLabelCount(5);
  yLabels.setValueFormatter(new MyValueFormatter());
  XAxis xLabels=mChart.getXAxis();
  xLabels.setPosition(XAxisPosition.TOP);
  mSeekBarX.setProgress(12);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
  l.setFormSize(8f);
  l.setFormToTextSpace(4f);
  l.setXEntrySpace(6f);
}

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_barchart);
  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=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setDrawValuesForWholeStack(true);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  YAxis yLabels=mChart.getAxisLeft();
  yLabels.setLabelCount(5);
  yLabels.setValueFormatter(new MyValueFormatter());
  mChart.getAxisRight().setValueFormatter(new MyValueFormatter());
  XAxis xLabels=mChart.getXAxis();
  xLabels.setPosition(XAxisPosition.TOP);
  mSeekBarX.setProgress(12);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
  l.setFormSize(8f);
  l.setFormToTextSpace(4f);
  l.setXEntrySpace(6f);
}
Program: 26698
Project: 26698
Buggy source:
/** 
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 * @param xIndex
 * @param dataSet
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(int xIndex,int dataSet,double yValue){
  BarEntry entry=mData.getDataSetByIndex(dataSet).getEntryForXIndex(xIndex);
  int stackIndex=entry.getClosestIndexAbove((float)yValue);
  Highlight h=new Highlight(xIndex,dataSet,stackIndex);
  return h;
}

Fixed version (ground truth):
/** 
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 * @param xIndex
 * @param dataSet
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(int xIndex,int dataSet,double yValue){
  BarEntry entry=mData.getDataSetByIndex(dataSet).getEntryForXIndex(xIndex);
  if (entry != null) {
    int stackIndex=entry.getClosestIndexAbove((float)yValue);
    Highlight h=new Highlight(xIndex,dataSet,stackIndex);
    return h;
  }
 else   return null;
}
Program: 26700
Project: 26700
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}

Fixed version (ground truth):
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}
Program: 26702
Project: 26702
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxis(mDrawCanvas);
  if (mDrawWeb)   mRenderer.drawExtras(mDrawCanvas);
  mYAxisRenderer.renderLimitLines(mDrawCanvas);
  mRenderer.drawData(mDrawCanvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(mDrawCanvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxis(mDrawCanvas);
  mRenderer.drawValues(mDrawCanvas);
  mLegendRenderer.renderLegend(mDrawCanvas,mLegend);
  drawDescription();
  drawMarkers();
  canvas.drawBitmap(mDrawBitmap,0,0,mDrawPaint);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxisLabels(mDrawCanvas);
  if (mDrawWeb)   mRenderer.drawExtras(mDrawCanvas);
  mYAxisRenderer.renderLimitLines(mDrawCanvas);
  mRenderer.drawData(mDrawCanvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(mDrawCanvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxisLabels(mDrawCanvas);
  mRenderer.drawValues(mDrawCanvas);
  mLegendRenderer.renderLegend(mDrawCanvas,mLegend);
  drawDescription();
  drawMarkers();
  canvas.drawBitmap(mDrawBitmap,0,0,mDrawPaint);
}
Program: 26703
Project: 26703
Buggy source:
/** 
 * This method enables a specified custom MarkerView to update it's content everytime the MarkerView is redrawn.
 * @param e The Entry the MarkerView belongs to. This can also be anysubclass of Entry, like BarEntry or CandleEntry.
 * @param dataSetIndex the index of the DataSet the selected value is in
 */
public abstract void refreshContent(Entry e,int dataSetIndex);

Fixed version (ground truth):
/** 
 * This method enables a specified custom MarkerView to update it's content everytime the MarkerView is redrawn.
 * @param e The Entry the MarkerView belongs to. This can also be anysubclass of Entry, like BarEntry or CandleEntry, simply cast it at runtime.
 * @param dataSetIndex the index of the DataSet the selected value is in
 */
public abstract void refreshContent(Entry e,int dataSetIndex);
Program: 26705
Project: 26705
Buggy source:
public float getRequiredHeightSpace(Paint p){
  String label=getLongestLabel();
  return (float)Utils.calcTextHeight(p,label) + getYOffset() * 2f;
}

Fixed version (ground truth):
public float getRequiredHeightSpace(Paint p){
  p.setTextSize(mTextSize);
  String label=getLongestLabel();
  return (float)Utils.calcTextHeight(p,label) + getYOffset() * 2f;
}
Program: 26706
Project: 26706
Buggy source:
public float getRequiredWidthSpace(Paint p){
  String label=getLongestLabel();
  return (float)Utils.calcTextWidth(p,label) + getXOffset() * 2f;
}

Fixed version (ground truth):
public float getRequiredWidthSpace(Paint p){
  p.setTextSize(mTextSize);
  String label=getLongestLabel();
  return (float)Utils.calcTextWidth(p,label) + getXOffset() * 2f;
}
Program: 26707
Project: 26707
Buggy source:
/** 
 * Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data. Use resetAxisMinValue() to undo this.
 * @param min
 */
public void setAxisMinValue(float min){
  mCustomAxisMin=min;
}

Fixed version (ground truth):
/** 
 * Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data. Use resetAxisMinValue() to undo this. Do not forget to call setStartAtZero(false) if you use this method. Otherwise, the axis-minimum value will still be forced to 0.
 * @param min
 */
public void setAxisMinValue(float min){
  mCustomAxisMin=min;
}
Program: 26708
Project: 26708
Buggy source:
public void computeAxis(float xValAverageLength,ArrayList<String> xValues){
  StringBuffer a=new StringBuffer();
  int max=(int)Math.round(xValAverageLength + mXAxis.getSpaceBetweenLabels());
  for (int i=0; i < max; i++) {
    a.append("String_Node_Str");
  }
  mXAxis.mLabelWidth=Utils.calcTextWidth(mAxisPaint,a.toString());
  mXAxis.mLabelHeight=Utils.calcTextHeight(mAxisPaint,"String_Node_Str");
  mXAxis.setValues(xValues);
}

Fixed version (ground truth):
public void computeAxis(float xValAverageLength,ArrayList<String> xValues){
  mAxisPaint.setTypeface(mXAxis.getTypeface());
  mAxisPaint.setTextSize(mXAxis.getTextSize());
  StringBuffer a=new StringBuffer();
  int max=(int)Math.round(xValAverageLength + mXAxis.getSpaceBetweenLabels());
  for (int i=0; i < max; i++) {
    a.append("String_Node_Str");
  }
  mXAxis.mLabelWidth=Utils.calcTextWidth(mAxisPaint,a.toString());
  mXAxis.mLabelHeight=Utils.calcTextHeight(mAxisPaint,"String_Node_Str");
  mXAxis.setValues(xValues);
}
Program: 26709
Project: 26709
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawFilled(true);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTypeface(tf);
  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((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawFilled(true);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTypeface(tf);
  data.setValueTextSize(9f);
  data.setDrawValues(false);
  mChart.setData(data);
}
Program: 26711
Project: 26711
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onValueSelected(Entry e,int dataSetIndex,Highlight h){
  if (e == null)   return;
  RectF bounds=mChart.getBarBounds((BarEntry)e);
  PointF position=mChart.getPosition(e,AxisDependency.LEFT);
  Log.i("String_Node_Str",bounds.toString());
  Log.i("String_Node_Str",position.toString());
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onValueSelected(Entry e,int dataSetIndex,Highlight h){
  if (e == null)   return;
  RectF bounds=mChart.getBarBounds((BarEntry)e);
  PointF position=mChart.getPosition(e,mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency());
  Log.i("String_Node_Str",bounds.toString());
  Log.i("String_Node_Str",position.toString());
}
Program: 26712
Project: 26712
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.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  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.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTextSize(10f);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.setData(data);
}
Program: 26713
Project: 26713
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> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range / 2f;
    float val=(float)(Math.random() * mult) + 50;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(ColorTemplate.getHoloBlue());
  set1.setLineWidth(2f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range;
    float val=(float)(Math.random() * mult) + 450;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.RED);
  set2.setLineWidth(2f);
  set2.setCircleSize(4f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTextColor(Color.WHITE);
  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> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range / 2f;
    float val=(float)(Math.random() * mult) + 50;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(ColorTemplate.getHoloBlue());
  set1.setLineWidth(2f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range;
    float val=(float)(Math.random() * mult) + 450;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.RED);
  set2.setLineWidth(2f);
  set2.setCircleSize(4f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTextColor(Color.WHITE);
  data.setValueTextSize(9f);
  mChart.setData(data);
}
Program: 26714
Project: 26714
Buggy source:
public void setData(){
  float mult=150;
  int cnt=9;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < cnt; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  for (int i=0; i < cnt; i++) {
    yVals2.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < cnt; i++)   xVals.add(mParties[i % mParties.length]);
  RadarDataSet set1=new RadarDataSet(yVals1,"String_Node_Str");
  set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  set1.setDrawFilled(true);
  set1.setLineWidth(2f);
  RadarDataSet set2=new RadarDataSet(yVals2,"String_Node_Str");
  set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
  set2.setDrawFilled(true);
  set2.setLineWidth(2f);
  ArrayList<RadarDataSet> sets=new ArrayList<RadarDataSet>();
  sets.add(set1);
  sets.add(set2);
  RadarData data=new RadarData(xVals,sets);
  data.setValueTypeface(tf);
  data.setValueTextSize(8f);
  mChart.setData(data);
  mChart.invalidate();
}

Fixed version (ground truth):
public void setData(){
  float mult=150;
  int cnt=9;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < cnt; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  for (int i=0; i < cnt; i++) {
    yVals2.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < cnt; i++)   xVals.add(mParties[i % mParties.length]);
  RadarDataSet set1=new RadarDataSet(yVals1,"String_Node_Str");
  set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  set1.setDrawFilled(true);
  set1.setLineWidth(2f);
  RadarDataSet set2=new RadarDataSet(yVals2,"String_Node_Str");
  set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
  set2.setDrawFilled(true);
  set2.setLineWidth(2f);
  ArrayList<RadarDataSet> sets=new ArrayList<RadarDataSet>();
  sets.add(set1);
  sets.add(set2);
  RadarData data=new RadarData(xVals,sets);
  data.setValueTypeface(tf);
  data.setValueTextSize(8f);
  data.setDrawValues(false);
  mChart.setData(data);
  mChart.invalidate();
}
Program: 26715
Project: 26715
Buggy source:
/** 
 * Returns the bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be found in the charts data.
 * @param e
 * @param dataSetIndex
 * @return
 */
public RectF getBarBounds(BarEntry e){
  BarDataSet set=mData.getDataSetForEntry(e);
  if (set == null)   return null;
  float barspace=set.getBarSpace();
  float y=e.getVal();
  float x=e.getXIndex();
  float spaceHalf=barspace / 2f;
  float left=x - 0.5f + spaceHalf;
  float right=x + 0.5f - spaceHalf;
  float top=y >= 0 ? y : 0;
  float bottom=y <= 0 ? y : 0;
  RectF bounds=new RectF(left,top,right,bottom);
  getTransformer(set.getAxisDependency()).rectValueToPixel(bounds);
  return bounds;
}

Fixed version (ground truth):
/** 
 * Returns the bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be found in the charts data.
 * @param e
 * @param dataSetIndex
 * @return
 */
public RectF getBarBounds(BarEntry e){
  BarDataSet set=mData.getDataSetForEntry(e);
  if (set == null)   return null;
  float barspace=set.getBarSpace();
  float y=e.getVal();
  float x=e.getXIndex();
  float barWidth=0.5f;
  float spaceHalf=barspace / 2f;
  float left=x - barWidth + spaceHalf;
  float right=x + barWidth - spaceHalf;
  float top=y >= 0 ? y : 0;
  float bottom=y <= 0 ? y : 0;
  RectF bounds=new RectF(left,top,right,bottom);
  getTransformer(set.getAxisDependency()).rectValueToPixel(bounds);
  return bounds;
}
Program: 26716
Project: 26716
Buggy source:
/** 
 * Returns the position (in pixels) the provided Entry has inside the chart view or null, if the provided Entry is null.
 * @param e
 * @return
 */
public PointF getPosition(Entry e,AxisDependency axis){
  if (e == null)   return null;
  float[] vals=new float[]{e.getXIndex(),e.getVal()};
  if (this instanceof BarChart) {
    BarDataSet set=(BarDataSet)mData.getDataSetForEntry(e);
    if (set != null)     vals[0]+=set.getBarSpace() / 2f;
  }
  getTransformer(axis).pointValuesToPixel(vals);
  return new PointF(vals[0],vals[1]);
}

Fixed version (ground truth):
/** 
 * Returns the position (in pixels) the provided Entry has inside the chart view or null, if the provided Entry is null.
 * @param e
 * @return
 */
public PointF getPosition(Entry e,AxisDependency axis){
  if (e == null)   return null;
  float[] vals=new float[]{e.getXIndex(),e.getVal()};
  getTransformer(axis).pointValuesToPixel(vals);
  return new PointF(vals[0],vals[1]);
}
Program: 26717
Project: 26717
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_radarchart);
  mChart=(RadarChart)findViewById(R.id.chart1);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setDescription("String_Node_Str");
  mChart.setWebLineWidth(1.5f);
  mChart.setWebLineWidthInner(0.75f);
  mChart.setWebAlpha(100);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  setData();
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  xl.setTextSize(9f);
  YAxis yl=mChart.getYAxis();
  yl.setTypeface(tf);
  yl.setLabelCount(5);
  yl.setTextSize(9f);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setTypeface(tf);
  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_radarchart);
  mChart=(RadarChart)findViewById(R.id.chart1);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setDescription("String_Node_Str");
  mChart.setWebLineWidth(1.5f);
  mChart.setWebLineWidthInner(0.75f);
  mChart.setWebAlpha(100);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  setData();
  XAxis xAxis=mChart.getXAxis();
  xAxis.setTypeface(tf);
  xAxis.setTextSize(9f);
  YAxis yAxis=mChart.getYAxis();
  yAxis.setTypeface(tf);
  yAxis.setLabelCount(5);
  yAxis.setTextSize(9f);
  yAxis.setStartAtZero(true);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setTypeface(tf);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}
Program: 26718
Project: 26718
Buggy source:
public void setData(){
  float mult=150;
  int cnt=9;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < cnt; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  for (int i=0; i < cnt; i++) {
    yVals2.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < cnt; i++)   xVals.add(mParties[i % mParties.length]);
  RadarDataSet set1=new RadarDataSet(yVals1,"String_Node_Str");
  set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  set1.setDrawFilled(true);
  set1.setLineWidth(2f);
  RadarDataSet set2=new RadarDataSet(yVals2,"String_Node_Str");
  set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
  set2.setDrawFilled(true);
  set2.setLineWidth(2f);
  ArrayList<RadarDataSet> sets=new ArrayList<RadarDataSet>();
  sets.add(set1);
  sets.add(set2);
  RadarData data=new RadarData(xVals,sets);
  data.setValueTypeface(tf);
  mChart.setData(data);
  mChart.invalidate();
}

Fixed version (ground truth):
public void setData(){
  float mult=150;
  int cnt=9;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < cnt; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  for (int i=0; i < cnt; i++) {
    yVals2.add(new Entry((float)(Math.random() * mult) + mult / 2,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < cnt; i++)   xVals.add(mParties[i % mParties.length]);
  RadarDataSet set1=new RadarDataSet(yVals1,"String_Node_Str");
  set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  set1.setDrawFilled(true);
  set1.setLineWidth(2f);
  RadarDataSet set2=new RadarDataSet(yVals2,"String_Node_Str");
  set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
  set2.setDrawFilled(true);
  set2.setLineWidth(2f);
  ArrayList<RadarDataSet> sets=new ArrayList<RadarDataSet>();
  sets.add(set1);
  sets.add(set2);
  RadarData data=new RadarData(xVals,sets);
  data.setValueTypeface(tf);
  data.setValueTextSize(8f);
  mChart.setData(data);
  mChart.invalidate();
}