nus-yam/ex-repair huggingface dataset:
Program: 18594
Project: 18594
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.setColor(Color.BLACK);
  set1.setLineWidth(0.5f);
  set1.setDrawValues(false);
  set1.setDrawCircles(false);
  set1.setDrawCubic(false);
  set1.setDrawFilled(true);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
  Legend l=mChart.getLegend();
  l.setEnabled(false);
}

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.setColor(Color.BLACK);
  set1.setLineWidth(0.5f);
  set1.setDrawValues(false);
  set1.setDrawCircles(false);
  set1.setDrawCubic(false);
  set1.setDrawFilled(false);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
  Legend l=mChart.getLegend();
  l.setEnabled(false);
}
Program: 18595
Project: 18595
Buggy source:
@Override protected void init(){
  super.init();
  mAxisLeft=new YAxis(AxisDependency.LEFT);
  mAxisRight=new YAxis(AxisDependency.RIGHT);
  mXAxis=new XAxis();
  mLeftAxisTransformer=new Transformer(mViewPortHandler);
  mRightAxisTransformer=new Transformer(mViewPortHandler);
  mAxisRendererLeft=new YAxisRenderer(mViewPortHandler,mAxisLeft,mLeftAxisTransformer);
  mAxisRendererRight=new YAxisRenderer(mViewPortHandler,mAxisRight,mRightAxisTransformer);
  mXAxisRenderer=new XAxisRenderer(mViewPortHandler,mXAxis,mLeftAxisTransformer);
  mListener=new BarLineChartTouchListener(this,mViewPortHandler.getMatrixTouch());
  mGridBackgroundPaint=new Paint();
  mGridBackgroundPaint.setStyle(Style.FILL);
  mGridBackgroundPaint.setColor(Color.rgb(240,240,240));
}

Fixed version (ground truth):
@Override protected void init(){
  super.init();
  mAxisLeft=new YAxis(AxisDependency.LEFT);
  mAxisRight=new YAxis(AxisDependency.RIGHT);
  mXAxis=new XAxis();
  mLeftAxisTransformer=new Transformer(mViewPortHandler);
  mRightAxisTransformer=new Transformer(mViewPortHandler);
  mAxisRendererLeft=new YAxisRenderer(mViewPortHandler,mAxisLeft,mLeftAxisTransformer);
  mAxisRendererRight=new YAxisRenderer(mViewPortHandler,mAxisRight,mRightAxisTransformer);
  mXAxisRenderer=new XAxisRenderer(mViewPortHandler,mXAxis,mLeftAxisTransformer);
  mListener=new BarLineChartTouchListener(this,mViewPortHandler.getMatrixTouch());
  mGridBackgroundPaint=new Paint();
  mGridBackgroundPaint.setStyle(Style.FILL);
  mGridBackgroundPaint.setColor(Color.rgb(240,240,240));
  mBorderPaint=new Paint();
  mBorderPaint.setStyle(Style.STROKE);
  mBorderPaint.setColor(Color.BLACK);
  mBorderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
}
Program: 18596
Project: 18596
Buggy source:
/** 
 * draws the grid background
 */
protected void drawGridBackground(Canvas c){
  if (!mDrawGridBackground)   return;
  c.drawRect(mViewPortHandler.getContentRect(),mGridBackgroundPaint);
}

Fixed version (ground truth):
/** 
 * draws the grid background
 */
protected void drawGridBackground(Canvas c){
  if (mDrawGridBackground) {
    c.drawRect(mViewPortHandler.getContentRect(),mGridBackgroundPaint);
  }
  if (mDrawBorders) {
    c.drawRect(mViewPortHandler.getContentRect(),mBorderPaint);
  }
}
Program: 18598
Project: 18598
Buggy source:
/** 
 * Removes all DataSets (and thereby Entries) from the chart. Does not remove the x-values.
 */
public void clearValues(){
  mData.clearValues();
  invalidate();
}

Fixed version (ground truth):
/** 
 * Removes all DataSets (and thereby Entries) from the chart. Does not remove the x-values. Also refreshes the chart by calling invalidate().
 */
public void clearValues(){
  mData.clearValues();
  invalidate();
}
Program: 18600
Project: 18600
Buggy source:
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  int maxx=mMaxX + 1;
  int minx=mMinX - 1;
  if (maxx > mXAxis.getValues().size())   maxx=mXAxis.getValues().size();
  if (minx < 0)   minx=0;
  for (int i=minx; i < maxx; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  int maxx=mMaxX;
  int minx=mMinX;
  if (maxx > mXAxis.getValues().size())   maxx=mXAxis.getValues().size();
  if (minx < 0)   minx=0;
  for (int i=minx; i <= maxx; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisPaint);
    }
  }
}
Program: 18601
Project: 18601
Buggy source:
@Override public void renderGridLines(Canvas c){
  calcXBounds(mTrans);
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] position=new float[]{0f,0f};
  mGridPaint.setColor(mXAxis.getGridColor());
  mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
  BarData bd=mChart.getData();
  int step=bd.getDataSetCount();
  for (int i=0; i < mXAxis.getValues().size(); i+=mXAxis.mAxisLabelModulus) {
    position[0]=i * step + i * bd.getGroupSpace() - 0.5f;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      c.drawLine(position[0],mViewPortHandler.offsetTop(),position[0],mViewPortHandler.contentBottom(),mGridPaint);
    }
  }
}

Fixed version (ground truth):
@Override public void renderGridLines(Canvas c){
  calcXBounds(mTrans);
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] position=new float[]{0f,0f};
  mGridPaint.setColor(mXAxis.getGridColor());
  mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
  BarData bd=mChart.getData();
  int step=bd.getDataSetCount();
  float div=(float)step + (step > 1 ? bd.getGroupSpace() : 0f);
  float min=(float)mMinX / div;
  float max=(float)mMaxX / div;
  for (int i=(int)min; i <= max; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i * step + i * bd.getGroupSpace() - 0.5f;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      c.drawLine(position[0],mViewPortHandler.offsetTop(),position[0],mViewPortHandler.contentBottom(),mGridPaint);
    }
  }
}
Program: 18602
Project: 18602
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=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.removeAllLimitLines();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.setData(data);
}
Program: 18604
Project: 18604
Buggy source:
/** 
 * Adds a new LimitLine to this axis.
 * @param l
 */
public void addLimitLine(LimitLine l){
  mLimitLines.add(l);
}

Fixed version (ground truth):
/** 
 * Adds a new LimitLine to this axis.
 * @param l
 */
public void addLimitLine(LimitLine l){
  mLimitLines.add(l);
  if (mLimitLines.size() > 6) {
    Log.e("String_Node_Str","String_Node_Str");
  }
}
Program: 18605
Project: 18605
Buggy source:
/** 
 * Removes all LimitLines from the axis.
 */
public void removeAllLimitLines(){
  mLimitLines=new ArrayList<LimitLine>();
}

Fixed version (ground truth):
/** 
 * Removes all LimitLines from the axis.
 */
public void removeAllLimitLines(){
  mLimitLines.clear();
}
Program: 18607
Project: 18607
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: 18608
Project: 18608
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: 18610
Project: 18610
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: 18612
Project: 18612
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: 18614
Project: 18614
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: 18615
Project: 18615
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: 18618
Project: 18618
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: 18619
Project: 18619
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: 18622
Project: 18622
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: 18623
Project: 18623
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: 18625
Project: 18625
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: 18626
Project: 18626
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: 18627
Project: 18627
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: 18628
Project: 18628
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: 18629
Project: 18629
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: 18630
Project: 18630
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();
}
Program: 18631
Project: 18631
Buggy source:
@Override protected void calcMinMax(){
  super.calcMinMax();
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float leftRange=Math.abs(maxLeft - (mYAxis.isStartAtZeroEnabled() ? 0 : minLeft));
  float topSpaceLeft=leftRange / 100f * mYAxis.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mYAxis.getSpaceBottom();
  mXChartMax=mData.getXVals().size() - 1;
  mDeltaX=Math.abs(mXChartMax - mXChartMin);
  mYAxis.mAxisMaximum=!Float.isNaN(mYAxis.getAxisMaxValue()) ? mYAxis.getAxisMaxValue() : maxLeft + topSpaceLeft;
  mYAxis.mAxisMinimum=!Float.isNaN(mYAxis.getAxisMinValue()) ? mYAxis.getAxisMinValue() : minLeft - bottomSpaceLeft;
  if (mYAxis.isStartAtZeroEnabled())   mYAxis.mAxisMinimum=0f;
  mYAxis.mAxisRange=Math.abs(mYAxis.mAxisMaximum - mYAxis.mAxisMinimum);
}

Fixed version (ground truth):
@Override protected void calcMinMax(){
  super.calcMinMax();
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  mXChartMax=mData.getXVals().size() - 1;
  mDeltaX=Math.abs(mXChartMax - mXChartMin);
  float leftRange=Math.abs(maxLeft - (mYAxis.isStartAtZeroEnabled() ? 0 : minLeft));
  float topSpaceLeft=leftRange / 100f * mYAxis.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mYAxis.getSpaceBottom();
  mXChartMax=mData.getXVals().size() - 1;
  mDeltaX=Math.abs(mXChartMax - mXChartMin);
  mYAxis.mAxisMaximum=!Float.isNaN(mYAxis.getAxisMaxValue()) ? mYAxis.getAxisMaxValue() : maxLeft + topSpaceLeft;
  mYAxis.mAxisMinimum=!Float.isNaN(mYAxis.getAxisMinValue()) ? mYAxis.getAxisMinValue() : minLeft - bottomSpaceLeft;
  if (mYAxis.isStartAtZeroEnabled())   mYAxis.mAxisMinimum=0f;
  mYAxis.mAxisRange=Math.abs(mYAxis.mAxisMaximum - mYAxis.mAxisMinimum);
}
Program: 18632
Project: 18632
Buggy source:
/** 
 * Returns the factor that is needed to transform values into pixels.
 * @return
 */
public float getFactor(){
  RectF content=mViewPortHandler.getContentRect();
  return (float)Math.min(content.width() / 2f,content.height() / 2f) / mYAxis.mAxisMaximum;
}

Fixed version (ground truth):
/** 
 * Returns the factor that is needed to transform values into pixels.
 * @return
 */
public float getFactor(){
  RectF content=mViewPortHandler.getContentRect();
  return (float)Math.min(content.width() / 2f,content.height() / 2f) / mYAxis.mAxisRange;
}
Program: 18633
Project: 18633
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(0f,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(mYAxis.mAxisMinimum,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}
Program: 18634
Project: 18634
Buggy source:
protected void drawDataSet(Canvas c,RadarDataSet dataSet){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  ArrayList<Entry> entries=dataSet.getYVals();
  Path surface=new Path();
  for (int j=0; j < entries.size(); j++) {
    mRenderPaint.setColor(dataSet.getColor(j));
    Entry e=entries.get(j);
    PointF p=Utils.getPosition(center,e.getVal() * factor,sliceangle * j + mChart.getRotationAngle());
    if (j == 0)     surface.moveTo(p.x,p.y);
 else     surface.lineTo(p.x,p.y);
  }
  surface.close();
  if (dataSet.isDrawFilledEnabled()) {
    mRenderPaint.setStyle(Paint.Style.FILL);
    mRenderPaint.setAlpha(dataSet.getFillAlpha());
    c.drawPath(surface,mRenderPaint);
    mRenderPaint.setAlpha(255);
  }
  mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
  mRenderPaint.setStyle(Paint.Style.STROKE);
  if (!dataSet.isDrawFilledEnabled() || dataSet.getFillAlpha() < 255)   c.drawPath(surface,mRenderPaint);
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,RadarDataSet dataSet){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  ArrayList<Entry> entries=dataSet.getYVals();
  Path surface=new Path();
  for (int j=0; j < entries.size(); j++) {
    mRenderPaint.setColor(dataSet.getColor(j));
    Entry e=entries.get(j);
    PointF p=Utils.getPosition(center,(e.getVal() - mChart.getYChartMin()) * factor,sliceangle * j + mChart.getRotationAngle());
    if (j == 0)     surface.moveTo(p.x,p.y);
 else     surface.lineTo(p.x,p.y);
  }
  surface.close();
  if (dataSet.isDrawFilledEnabled()) {
    mRenderPaint.setStyle(Paint.Style.FILL);
    mRenderPaint.setAlpha(dataSet.getFillAlpha());
    c.drawPath(surface,mRenderPaint);
    mRenderPaint.setAlpha(255);
  }
  mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
  mRenderPaint.setStyle(Paint.Style.STROKE);
  if (!dataSet.isDrawFilledEnabled() || dataSet.getFillAlpha() < 255)   c.drawPath(surface,mRenderPaint);
}
Program: 18635
Project: 18635
Buggy source:
protected void drawWeb(Canvas c){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  float rotationangle=mChart.getRotationAngle();
  PointF center=mChart.getCenterOffsets();
  mWebPaint.setStrokeWidth(mChart.getWebLineWidth());
  mWebPaint.setColor(mChart.getWebColor());
  mWebPaint.setAlpha(mChart.getWebAlpha());
  for (int i=0; i < mChart.getData().getXValCount(); i++) {
    PointF p=Utils.getPosition(center,mChart.getYChartMax() * factor,sliceangle * i + rotationangle);
    c.drawLine(center.x,center.y,p.x,p.y,mWebPaint);
  }
  mWebPaint.setStrokeWidth(mChart.getWebLineWidthInner());
  mWebPaint.setColor(mChart.getWebColorInner());
  mWebPaint.setAlpha(mChart.getWebAlpha());
  int labelCount=mChart.getYAxis().mEntryCount;
  for (int j=0; j < labelCount; j++) {
    for (int i=0; i < mChart.getData().getXValCount(); i++) {
      float r=mChart.getYAxis().mEntries[j] * factor;
      PointF p1=Utils.getPosition(center,r,sliceangle * i + rotationangle);
      PointF p2=Utils.getPosition(center,r,sliceangle * (i + 1) + rotationangle);
      c.drawLine(p1.x,p1.y,p2.x,p2.y,mWebPaint);
    }
  }
}

Fixed version (ground truth):
protected void drawWeb(Canvas c){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  float rotationangle=mChart.getRotationAngle();
  PointF center=mChart.getCenterOffsets();
  mWebPaint.setStrokeWidth(mChart.getWebLineWidth());
  mWebPaint.setColor(mChart.getWebColor());
  mWebPaint.setAlpha(mChart.getWebAlpha());
  for (int i=0; i < mChart.getData().getXValCount(); i++) {
    PointF p=Utils.getPosition(center,mChart.getYRange() * factor,sliceangle * i + rotationangle);
    c.drawLine(center.x,center.y,p.x,p.y,mWebPaint);
  }
  mWebPaint.setStrokeWidth(mChart.getWebLineWidthInner());
  mWebPaint.setColor(mChart.getWebColorInner());
  mWebPaint.setAlpha(mChart.getWebAlpha());
  int labelCount=mChart.getYAxis().mEntryCount;
  for (int j=0; j < labelCount; j++) {
    for (int i=0; i < mChart.getData().getXValCount(); i++) {
      float r=(mChart.getYAxis().mEntries[j] - mChart.getYChartMin()) * factor;
      PointF p1=Utils.getPosition(center,r,sliceangle * i + rotationangle);
      PointF p2=Utils.getPosition(center,r,sliceangle * (i + 1) + rotationangle);
      c.drawLine(p1.x,p1.y,p2.x,p2.y,mWebPaint);
    }
  }
}
Program: 18636
Project: 18636
Buggy source:
@Override public void drawValues(Canvas c){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  float yoffset=Utils.convertDpToPixel(5f);
  for (int i=0; i < mChart.getData().getDataSetCount(); i++) {
    RadarDataSet dataSet=mChart.getData().getDataSetByIndex(i);
    if (!dataSet.isDrawValuesEnabled())     continue;
    applyValueTextStyle(dataSet);
    ArrayList<Entry> entries=dataSet.getYVals();
    for (int j=0; j < entries.size(); j++) {
      Entry e=entries.get(j);
      PointF p=Utils.getPosition(center,e.getVal() * factor,sliceangle * j + mChart.getRotationAngle());
      c.drawText(dataSet.getValueFormatter().getFormattedValue(e.getVal()),p.x,p.y - yoffset,mValuePaint);
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  float yoffset=Utils.convertDpToPixel(5f);
  for (int i=0; i < mChart.getData().getDataSetCount(); i++) {
    RadarDataSet dataSet=mChart.getData().getDataSetByIndex(i);
    if (!dataSet.isDrawValuesEnabled())     continue;
    applyValueTextStyle(dataSet);
    ArrayList<Entry> entries=dataSet.getYVals();
    for (int j=0; j < entries.size(); j++) {
      Entry e=entries.get(j);
      PointF p=Utils.getPosition(center,(e.getVal() - mChart.getYChartMin()) * factor,sliceangle * j + mChart.getRotationAngle());
      c.drawText(dataSet.getValueFormatter().getFormattedValue(e.getVal()),p.x,p.y - yoffset,mValuePaint);
    }
  }
}
Program: 18637
Project: 18637
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < indices.length; i++) {
    RadarDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null)     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    Entry e=set.getEntryForXIndex(xIndex);
    int j=set.getEntryPosition(e);
    float y=e.getVal();
    PointF p=Utils.getPosition(center,y * factor,sliceangle * j + mChart.getRotationAngle());
    float[] pts=new float[]{p.x,0,p.x,mViewPortHandler.getChartHeight(),0,p.y,mViewPortHandler.getChartWidth(),p.y};
    c.drawLines(pts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < indices.length; i++) {
    RadarDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null)     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    Entry e=set.getEntryForXIndex(xIndex);
    int j=set.getEntryPosition(e);
    float y=(e.getVal() - mChart.getYChartMin());
    PointF p=Utils.getPosition(center,y * factor,sliceangle * j + mChart.getRotationAngle());
    float[] pts=new float[]{p.x,0,p.x,mViewPortHandler.getChartHeight(),0,p.y,mViewPortHandler.getChartWidth(),p.y};
    c.drawLines(pts,mHighlightPaint);
  }
}
Program: 18638
Project: 18638
Buggy source:
@Override public void renderAxisLabels(Canvas c){
  if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())   return;
  mAxisPaint.setTypeface(mXAxis.getTypeface());
  mAxisPaint.setTextSize(mXAxis.getTextSize());
  mAxisPaint.setColor(mXAxis.getTextColor());
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < mXAxis.getValues().size(); i++) {
    String text=mXAxis.getValues().get(i);
    float angle=(sliceangle * i + mChart.getRotationAngle()) % 360f;
    PointF p=Utils.getPosition(center,mChart.getYChartMax() * factor + mXAxis.mLabelWidth / 2f,angle);
    c.drawText(text,p.x,p.y + mXAxis.mLabelHeight / 2f,mAxisPaint);
  }
}

Fixed version (ground truth):
@Override public void renderAxisLabels(Canvas c){
  if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())   return;
  mAxisPaint.setTypeface(mXAxis.getTypeface());
  mAxisPaint.setTextSize(mXAxis.getTextSize());
  mAxisPaint.setColor(mXAxis.getTextColor());
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < mXAxis.getValues().size(); i++) {
    String text=mXAxis.getValues().get(i);
    float angle=(sliceangle * i + mChart.getRotationAngle()) % 360f;
    PointF p=Utils.getPosition(center,mChart.getYRange() * factor + mXAxis.mLabelWidth / 2f,angle);
    c.drawText(text,p.x,p.y + mXAxis.mLabelHeight / 2f,mAxisPaint);
  }
}
Program: 18639
Project: 18639
Buggy source:
@Override public void renderAxisLabels(Canvas c){
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())   return;
  mAxisPaint.setTypeface(mYAxis.getTypeface());
  mAxisPaint.setTextSize(mYAxis.getTextSize());
  mAxisPaint.setColor(mYAxis.getTextColor());
  PointF center=mChart.getCenterOffsets();
  float factor=mChart.getFactor();
  int labelCount=mYAxis.mEntryCount;
  for (int j=0; j < labelCount; j++) {
    if (j == labelCount - 1 && mYAxis.isDrawTopYLabelEntryEnabled() == false)     break;
    float r=mYAxis.mEntries[j] * factor;
    PointF p=Utils.getPosition(center,r,mChart.getRotationAngle());
    String label=mYAxis.getFormattedLabel(j);
    c.drawText(label,p.x + 10,p.y,mAxisPaint);
  }
}

Fixed version (ground truth):
@Override public void renderAxisLabels(Canvas c){
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())   return;
  mAxisPaint.setTypeface(mYAxis.getTypeface());
  mAxisPaint.setTextSize(mYAxis.getTextSize());
  mAxisPaint.setColor(mYAxis.getTextColor());
  PointF center=mChart.getCenterOffsets();
  float factor=mChart.getFactor();
  int labelCount=mYAxis.mEntryCount;
  for (int j=0; j < labelCount; j++) {
    if (j == labelCount - 1 && mYAxis.isDrawTopYLabelEntryEnabled() == false)     break;
    float r=(mYAxis.mEntries[j] - mYAxis.mAxisMinimum) * factor;
    PointF p=Utils.getPosition(center,r,mChart.getRotationAngle());
    String label=mYAxis.getFormattedLabel(j);
    c.drawText(label,p.x + 10,p.y,mAxisPaint);
  }
}
Program: 18640
Project: 18640
Buggy source:
@Override public void renderLimitLines(Canvas c){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null)   return;
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    float r=l.getLimit() * factor;
    Path limitPath=new Path();
    for (int j=0; j < mChart.getData().getXValCount(); j++) {
      PointF p=Utils.getPosition(center,r,sliceangle * j + mChart.getRotationAngle());
      if (j == 0)       limitPath.moveTo(p.x,p.y);
 else       limitPath.lineTo(p.x,p.y);
    }
    limitPath.close();
    c.drawPath(limitPath,mLimitLinePaint);
  }
}

Fixed version (ground truth):
@Override public void renderLimitLines(Canvas c){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null)   return;
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    float r=(l.getLimit() - mChart.getYChartMin()) * factor;
    Path limitPath=new Path();
    for (int j=0; j < mChart.getData().getXValCount(); j++) {
      PointF p=Utils.getPosition(center,r,sliceangle * j + mChart.getRotationAngle());
      if (j == 0)       limitPath.moveTo(p.x,p.y);
 else       limitPath.lineTo(p.x,p.y);
    }
    limitPath.close();
    c.drawPath(limitPath,mLimitLinePaint);
  }
}
Program: 18641
Project: 18641
Buggy source:
protected boolean passesCheck(){
  return mChart.getBarData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleY();
}

Fixed version (ground truth):
@Override protected boolean passesCheck(){
  return mChart.getBarData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleY();
}