nus-yam/ex-repair huggingface dataset:
Program: 26829
Project: 26829
Buggy source:
/** 
 * Draws the LimitLines associated with this axis to the screen.
 * @param c
 */
public void renderLimitLines(Canvas c,ValueFormatter valueFormatter){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null)   return;
  float[] pts=new float[4];
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[1]=l.getLimit();
    pts[3]=l.getLimit();
    mTrans.pointValuesToPixel(pts);
    pts[0]=0;
    pts[2]=mViewPortHandler.getChartWidth();
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    c.drawLines(pts,mLimitLinePaint);
    if (l.isDrawValueEnabled()) {
      float xOffset=Utils.convertDpToPixel(4f);
      float yOffset=l.getLineWidth() + xOffset;
      String label=valueFormatter.getFormattedValue(l.getLimit());
      mLimitLinePaint.setPathEffect(null);
      mLimitLinePaint.setColor(l.getTextColor());
      if (l.getLabelPosition() == LimitLabelPosition.POS_RIGHT) {
        mLimitLinePaint.setTextAlign(Align.RIGHT);
        c.drawText(label,mViewPortHandler.contentRight() - xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
 else {
        mLimitLinePaint.setTextAlign(Align.LEFT);
        c.drawText(label,mViewPortHandler.offsetLeft() + xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Draws the LimitLines associated with this axis to the screen.
 * @param c
 */
public void renderLimitLines(Canvas c,ValueFormatter valueFormatter){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null || limitLines.size() <= 0)   return;
  float[] pts=new float[4];
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[1]=l.getLimit();
    pts[3]=l.getLimit();
    mTrans.pointValuesToPixel(pts);
    pts[0]=0;
    pts[2]=mViewPortHandler.getChartWidth();
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    c.drawLines(pts,mLimitLinePaint);
    if (l.isDrawValueEnabled()) {
      float xOffset=Utils.convertDpToPixel(4f);
      float yOffset=l.getLineWidth() + xOffset;
      String label=valueFormatter.getFormattedValue(l.getLimit());
      mLimitLinePaint.setPathEffect(null);
      mLimitLinePaint.setColor(l.getTextColor());
      if (l.getLabelPosition() == LimitLabelPosition.POS_RIGHT) {
        mLimitLinePaint.setTextAlign(Align.RIGHT);
        c.drawText(label,mViewPortHandler.contentRight() - xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
 else {
        mLimitLinePaint.setTextAlign(Align.LEFT);
        c.drawText(label,mViewPortHandler.offsetLeft() + xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
    }
  }
}
Program: 26830
Project: 26830
Buggy source:
/** 
 * Prepares the matrix that transforms values to pixels. Calculates the scale factors from the charts size and offsets.
 * @param chart
 */
public void prepareMatrixValuePx(ViewPortHandler viewport,float deltaX,float deltaY,float yChartMin){
  float scaleX=(float)((viewport.getChartWidth() - viewport.offsetRight() - viewport.offsetLeft()) / deltaX);
  float scaleY=(float)((viewport.getChartHeight() - viewport.offsetTop() - viewport.offsetBottom()) / deltaY);
  mMatrixValueToPx.reset();
  mMatrixValueToPx.postTranslate(0,-yChartMin);
  mMatrixValueToPx.postScale(scaleX,-scaleY);
}

Fixed version (ground truth):
/** 
 * Prepares the matrix that transforms values to pixels. Calculates the scale factors from the charts size and offsets.
 * @param chart
 */
public void prepareMatrixValuePx(float deltaX,float deltaY,float yChartMin){
  float scaleX=(float)((mViewPortHandler.getChartWidth() - mViewPortHandler.offsetRight() - mViewPortHandler.offsetLeft()) / deltaX);
  float scaleY=(float)((mViewPortHandler.getChartHeight() - mViewPortHandler.offsetTop() - mViewPortHandler.offsetBottom()) / deltaY);
  mMatrixValueToPx.reset();
  mMatrixValueToPx.postTranslate(0,-yChartMin);
  mMatrixValueToPx.postScale(scaleX,-scaleY);
}
Program: 26831
Project: 26831
Buggy source:
/** 
 * Prepares the matrix that contains all offsets.
 * @param chart
 */
public void prepareMatrixOffset(ViewPortHandler viewport,boolean inverted){
  mMatrixOffset.reset();
  if (!inverted)   mMatrixOffset.postTranslate(viewport.offsetLeft(),viewport.getChartHeight() - viewport.offsetBottom());
 else {
    mMatrixOffset.setTranslate(viewport.offsetLeft(),-viewport.offsetTop());
    mMatrixOffset.postScale(1.0f,-1.0f);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the matrix that contains all offsets.
 * @param chart
 */
public void prepareMatrixOffset(boolean inverted){
  mMatrixOffset.reset();
  if (!inverted)   mMatrixOffset.postTranslate(mViewPortHandler.offsetLeft(),mViewPortHandler.getChartHeight() - mViewPortHandler.offsetBottom());
 else {
    mMatrixOffset.setTranslate(mViewPortHandler.offsetLeft(),-mViewPortHandler.offsetTop());
    mMatrixOffset.postScale(1.0f,-1.0f);
  }
}
Program: 26833
Project: 26833
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);
  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);
  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: 26834
Project: 26834
Buggy source:
/** 
 * Draws the LimitLines associated with this axis to the screen.
 * @param c
 */
public void renderLimitLines(Canvas c){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null || limitLines.size() <= 0)   return;
  float[] pts=new float[4];
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[1]=l.getLimit();
    pts[3]=l.getLimit();
    mTrans.pointValuesToPixel(pts);
    pts[0]=0;
    pts[2]=mViewPortHandler.getChartWidth();
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    c.drawLines(pts,mLimitLinePaint);
    String label=l.getLabel();
    if (label != null && !label.equals("String_Node_Str")) {
      float xOffset=Utils.convertDpToPixel(4f);
      float yOffset=l.getLineWidth() + xOffset;
      mLimitLinePaint.setPathEffect(null);
      mLimitLinePaint.setColor(l.getTextColor());
      mLimitLinePaint.setStrokeWidth(1f);
      mLimitLinePaint.setTextSize(l.getTextSize());
      if (l.getLabelPosition() == LimitLabelPosition.POS_RIGHT) {
        mLimitLinePaint.setTextAlign(Align.RIGHT);
        c.drawText(label,mViewPortHandler.contentRight() - xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
 else {
        mLimitLinePaint.setTextAlign(Align.LEFT);
        c.drawText(label,mViewPortHandler.offsetLeft() + xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Draws the LimitLines associated with this axis to the screen.
 * @param c
 */
public void renderLimitLines(Canvas c){
  ArrayList<LimitLine> limitLines=mYAxis.getLimitLines();
  if (limitLines == null || limitLines.size() <= 0)   return;
  float[] pts=new float[4];
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[1]=l.getLimit();
    pts[3]=l.getLimit();
    mTrans.pointValuesToPixel(pts);
    pts[0]=0;
    pts[2]=mViewPortHandler.getChartWidth();
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    c.drawLines(pts,mLimitLinePaint);
    String label=l.getLabel();
    if (label != null && !label.equals("String_Node_Str")) {
      float xOffset=Utils.convertDpToPixel(4f);
      float yOffset=l.getLineWidth() + Utils.calcTextHeight(mLimitLinePaint,label) / 2f;
      mLimitLinePaint.setPathEffect(null);
      mLimitLinePaint.setColor(l.getTextColor());
      mLimitLinePaint.setStrokeWidth(0.5f);
      mLimitLinePaint.setTextSize(l.getTextSize());
      if (l.getLabelPosition() == LimitLabelPosition.POS_RIGHT) {
        mLimitLinePaint.setTextAlign(Align.RIGHT);
        c.drawText(label,mViewPortHandler.contentRight() - xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
 else {
        mLimitLinePaint.setTextAlign(Align.LEFT);
        c.drawText(label,mViewPortHandler.offsetLeft() + xOffset,pts[1] - yOffset,mLimitLinePaint);
      }
    }
  }
}
Program: 26835
Project: 26835
Buggy source:
private LineDataSet createSet(){
  LineDataSet set=new LineDataSet(null,"String_Node_Str");
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  set.setColor(Color.rgb(240,99,99));
  set.setCircleColor(Color.rgb(240,99,99));
  set.setHighLightColor(Color.rgb(190,190,190));
  return set;
}

Fixed version (ground truth):
private LineDataSet createSet(){
  LineDataSet set=new LineDataSet(null,"String_Node_Str");
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  set.setColor(Color.rgb(240,99,99));
  set.setCircleColor(Color.rgb(240,99,99));
  set.setHighLightColor(Color.rgb(190,190,190));
  set.setAxisDependency(AxisDependency.LEFT);
  return set;
}
Program: 26836
Project: 26836
Buggy source:
private LineData getData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float val=(float)(Math.random() * range) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.75f);
  set1.setCircleSize(3f);
  set1.setColor(Color.WHITE);
  set1.setCircleColor(Color.WHITE);
  set1.setHighLightColor(Color.WHITE);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  return data;
}

Fixed version (ground truth):
private LineData getData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float val=(float)(Math.random() * range) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.75f);
  set1.setCircleSize(3f);
  set1.setColor(Color.WHITE);
  set1.setCircleColor(Color.WHITE);
  set1.setHighLightColor(Color.WHITE);
  set1.setDrawValues(false);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  return data;
}
Program: 26837
Project: 26837
Buggy source:
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDrawBorder(false);
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setGridWidth(1.25f);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setValueTypeface(mTf);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setForm(LegendForm.CIRCLE);
  l.setFormSize(6f);
  l.setTextColor(Color.WHITE);
  l.setTypeface(mTf);
  YAxis y=chart.getAxisLeft();
  y.setTextColor(Color.WHITE);
  y.setTypeface(mTf);
  y.setLabelCount(4);
  XAxis x=chart.getXAxis();
  x.setTextColor(Color.WHITE);
  x.setTypeface(mTf);
  x.setDrawGridLines(false);
  chart.animateX(2500);
}

Fixed version (ground truth):
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDrawBorder(false);
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setGridWidth(1.25f);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setValueTypeface(mTf);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setForm(LegendForm.CIRCLE);
  l.setFormSize(6f);
  l.setTextColor(Color.WHITE);
  l.setTypeface(mTf);
  YAxis leftAxis=chart.getAxisLeft();
  leftAxis.setTextColor(Color.WHITE);
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(4);
  leftAxis.setDrawGridLines(false);
  chart.getAxisRight().setEnabled(false);
  XAxis x=chart.getXAxis();
  x.setTextColor(Color.WHITE);
  x.setTypeface(mTf);
  x.setDrawGridLines(false);
  chart.animateX(2500);
}
Program: 26839
Project: 26839
Buggy source:
/** 
 * Adds an Entry to the DataSet at the specified index. Entries are added to the end of the list.
 * @param e
 * @param dataSetIndex
 */
public void addEntry(Entry e,int dataSetIndex){
  float val=e.getVal();
  mYValCount+=1;
  mYValueSum+=val;
  if (mYMax < val)   mYMax=val;
  if (mYMin > val)   mYMin=val;
  if (mDataSets == null)   mDataSets=new ArrayList<T>();
  if (mDataSets.size() > dataSetIndex) {
    T set=mDataSets.get(dataSetIndex);
    if (set != null) {
      set.addEntry(e);
    }
  }
 else {
    Log.e("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Adds an Entry to the DataSet at the specified index. Entries are added to the end of the list.
 * @param e
 * @param dataSetIndex
 */
public void addEntry(Entry e,int dataSetIndex){
  if (mDataSets == null)   mDataSets=new ArrayList<T>();
  if (mDataSets.size() > dataSetIndex && dataSetIndex >= 0) {
    float val=e.getVal();
    mYValCount+=1;
    mYValueSum+=val;
    if (mYMax < val)     mYMax=val;
    if (mYMin > val)     mYMin=val;
    if (mDataSets == null)     mDataSets=new ArrayList<T>();
    T set=mDataSets.get(dataSetIndex);
    if (set != null) {
      if (set.getAxisDependency() == AxisDependency.LEFT) {
        if (mLeftAxisMax < e.getVal())         mLeftAxisMax=e.getVal();
        if (mLeftAxisMin > e.getVal())         mLeftAxisMin=e.getVal();
      }
 else {
        if (mRightAxisMax < e.getVal())         mRightAxisMax=e.getVal();
        if (mRightAxisMin > e.getVal())         mRightAxisMin=e.getVal();
      }
      set.addEntry(e);
    }
  }
 else {
    Log.e("String_Node_Str","String_Node_Str");
  }
}
Program: 26840
Project: 26840
Buggy source:
/** 
 * Adds a DataSet dynamically.
 * @param d
 */
public void addDataSet(T d){
  if (mDataSets == null)   mDataSets=new ArrayList<T>();
  mDataSets.add(d);
  mYValCount+=d.getEntryCount();
  mYValueSum+=d.getYValueSum();
  if (mYMax < d.getYMax())   mYMax=d.getYMax();
  if (mYMin > d.getYMin())   mYMin=d.getYMin();
}

Fixed version (ground truth):
/** 
 * Adds a DataSet dynamically.
 * @param d
 */
public void addDataSet(T d){
  if (mDataSets == null)   mDataSets=new ArrayList<T>();
  mDataSets.add(d);
  mYValCount+=d.getEntryCount();
  mYValueSum+=d.getYValueSum();
  if (mYMax < d.getYMax())   mYMax=d.getYMax();
  if (mYMin > d.getYMin())   mYMin=d.getYMin();
  if (d.getAxisDependency() == AxisDependency.LEFT) {
    if (mLeftAxisMax < d.getYMax())     mLeftAxisMax=d.getYMax();
    if (mLeftAxisMin > d.getYMin())     mLeftAxisMin=d.getYMin();
  }
 else {
    if (mRightAxisMax < d.getYMax())     mRightAxisMax=d.getYMax();
    if (mRightAxisMin > d.getYMin())     mRightAxisMin=d.getYMin();
  }
}
Program: 26841
Project: 26841
Buggy source:
public void setAxisDependency(AxisDependency dependency){
  mAxisDependency=dependency;
}

Fixed version (ground truth):
/** 
 * Set the y-axis this DataSet should be plotted against (either LEFT or RIGHT). Default: LEFT
 * @param dependency
 */
public void setAxisDependency(AxisDependency dependency){
  mAxisDependency=dependency;
}
Program: 26842
Project: 26842
Buggy source:
public AxisDependency getAxisDependency(){
  return mAxisDependency;
}

Fixed version (ground truth):
/** 
 * Returns the axis this DataSet should be plotted against.
 * @return
 */
public AxisDependency getAxisDependency(){
  return mAxisDependency;
}
Program: 26843
Project: 26843
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.setDrawYValues(false);
  mChart.setPinchZoom(false);
  mChart.setValueFormatter(new LargeValueFormatter());
  mChart.setDrawBarShadow(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawHorizontalGrid(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE);
  l.setTypeface(tf);
  XLabels xl=mChart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  YLabels yl=mChart.getYLabels();
  yl.setTypeface(tf);
  yl.setFormatter(new LargeValueFormatter());
  mChart.setValueTypeface(tf);
}

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.setDrawYValues(false);
  mChart.setPinchZoom(false);
  mChart.setValueFormatter(new LargeValueFormatter());
  mChart.setDrawBarShadow(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawHorizontalGrid(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE);
  l.setTypeface(tf);
  XLabels xl=mChart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  YLabels yl=mChart.getYLabels();
  yl.setTypeface(tf);
  yl.setFormatter(new LargeValueFormatter());
  mChart.setValueTypeface(tf);
}
Program: 26844
Project: 26844
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(true);
  mChart.setDrawYValues(true);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setInvertYAxisEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  XLabels xl=mChart.getXLabels();
  xl.setAvoidFirstLastClipping(true);
  setData(25,50);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}

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

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartGestureListener(this);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setUnit("String_Node_Str");
  mChart.setDrawUnitsInChart(true);
  mChart.setStartAtZero(false);
  mChart.setDrawYValues(false);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(45,100);
  mChart.animateX(2500);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
}
Program: 26847
Project: 26847
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);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setDescription("String_Node_Str");
  mChart.setUnit("String_Node_Str");
  mChart.setDrawUnitsInChart(true);
  mChart.setWebLineWidth(1.5f);
  mChart.setWebLineWidthInner(0.75f);
  mChart.setWebAlpha(100);
  mChart.setDrawYValues(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  setData();
  XLabels xl=mChart.getXLabels();
  xl.setTypeface(tf);
  xl.setTextSize(9f);
  YLabels yl=mChart.getYLabels();
  yl.setTypeface(tf);
  yl.setLabelCount(5);
  yl.setTextSize(9f);
  yl.setDrawUnitsInYLabel(true);
  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);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setDescription("String_Node_Str");
  mChart.setUnit("String_Node_Str");
  mChart.setDrawUnitsInChart(true);
  mChart.setWebLineWidth(1.5f);
  mChart.setWebLineWidthInner(0.75f);
  mChart.setWebAlpha(100);
  mChart.setDrawYValues(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  setData();
  XLabels xl=mChart.getXLabels();
  xl.setTypeface(tf);
  xl.setTextSize(9f);
  YLabels yl=mChart.getYLabels();
  yl.setTypeface(tf);
  yl.setLabelCount(5);
  yl.setTextSize(9f);
  yl.setDrawUnitsInYLabel(true);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setTypeface(tf);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}
Program: 26848
Project: 26848
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_bar,container,false);
  mChart=new BarChart(getActivity());
  mChart.setDescription("String_Node_Str");
  MyMarkerView mv=new MyMarkerView(getActivity(),R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  mChart.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  mChart.setDrawBarShadow(false);
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  mChart.setData(generateBarData(1,20000,12));
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  YLabels labels=mChart.getYLabels();
  labels.setTypeface(tf);
  FrameLayout parent=(FrameLayout)v.findViewById(R.id.parentLayout);
  parent.addView(mChart);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_bar,container,false);
  mChart=new BarChart(getActivity());
  mChart.setDescription("String_Node_Str");
  MyMarkerView mv=new MyMarkerView(getActivity(),R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  mChart.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  mChart.setDrawBarShadow(false);
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  mChart.setData(generateBarData(1,20000,12));
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  YLabels labels=mChart.getYLabels();
  labels.setTypeface(tf);
  FrameLayout parent=(FrameLayout)v.findViewById(R.id.parentLayout);
  parent.addView(mChart);
  return v;
}
Program: 26849
Project: 26849
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_scatter,container,false);
  mChart=(ScatterChart)v.findViewById(R.id.scatterChart1);
  mChart.setDrawYValues(false);
  mChart.setDescription("String_Node_Str");
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  YLabels labels=mChart.getYLabels();
  labels.setTypeface(tf);
  MyMarkerView mv=new MyMarkerView(getActivity(),R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  mChart.setUnit("String_Node_Str");
  mChart.setData(generateScatterData(3,10000,150));
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_scatter,container,false);
  mChart=(ScatterChart)v.findViewById(R.id.scatterChart1);
  mChart.setDrawYValues(false);
  mChart.setDescription("String_Node_Str");
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  YLabels labels=mChart.getYLabels();
  labels.setTypeface(tf);
  MyMarkerView mv=new MyMarkerView(getActivity(),R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  mChart.setUnit("String_Node_Str");
  mChart.setData(generateScatterData(3,10000,150));
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  return v;
}
Program: 26850
Project: 26850
Buggy source:
/** 
 * set a description text that appears in the bottom right corner of the chart, size = Y-legend text size
 * @param desc
 */
public void setDescription(String desc){
  this.mDescription=desc;
}

Fixed version (ground truth):
/** 
 * set a description text that appears in the bottom right corner of the chart, size = Y-legend text size
 * @param desc
 */
public void setDescription(String desc){
  if (desc == null)   desc="String_Node_Str";
  this.mDescription=desc;
}
Program: 26851
Project: 26851
Buggy source:
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mPhaseX) {
      Entry e=getEntryByDataSetIndex(xIndex,dataSetIndex);
      if (e == null)       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (pos[0] < mOffsetLeft || pos[0] > getWidth() - mOffsetRight || pos[1] < mOffsetTop || pos[1] > getHeight() - mOffsetBottom)       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      mMarkerView.draw(mDrawCanvas,pos[0],pos[1]);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mPhaseX) {
      Entry e=getEntryByDataSetIndex(xIndex,dataSetIndex);
      if (e == null)       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (pos[0] < mOffsetLeft || pos[0] > getWidth() - mOffsetRight || pos[1] < mOffsetTop || pos[1] > getHeight() - mOffsetBottom)       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      if (pos[1] - mMarkerView.getHeight() <= 0) {
        float y=mMarkerView.getHeight() - pos[1];
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1] + y);
      }
 else {
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1]);
      }
    }
  }
}
Program: 26852
Project: 26852
Buggy source:
/** 
 * Set the hole in the center of the PieChart transparent. Thank you, code provided by:
 * @link https://github.com/wogg
 * @param enable
 */
public void setHoleColorTransparent(boolean enable){
  if (enable) {
    mHolePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
  }
 else {
    mHolePaint.setXfermode(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the hole in the center of the PieChart transparent. Thank you, code provided by:
 * @link https://github.com/tbarthel-fr
 * @param enable
 */
public void setHoleColorTransparent(boolean enable){
  if (enable) {
    mHolePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
  }
 else {
    mHolePaint.setXfermode(null);
  }
}
Program: 26853
Project: 26853
Buggy source:
/** 
 * returns the x-offset that is set for the MarkerView
 * @return
 */
public float getXOffset(){
  return mXOffset;
}

Fixed version (ground truth):
/** 
 * Use this to return the desired offset you wish the MarkerView to have on the x-axis. By returning -(getWidth() / 2) you will center the MarkerView horizontally.
 * @return
 */
public abstract int getXOffset();
Program: 26854
Project: 26854
Buggy source:
/** 
 * Draws the MarkerView on the given position on the screen with the given Canvas object.
 * @param canvas
 * @param posx
 * @param posy
 */
public void draw(Canvas canvas,float posx,float posy){
  posx+=mXOffset;
  posy+=mYOffset;
  canvas.translate(posx,posy);
  draw(canvas);
  canvas.translate(-posx,-posy);
}

Fixed version (ground truth):
/** 
 * Draws the MarkerView on the given position on the screen with the given Canvas object.
 * @param canvas
 * @param posx
 * @param posy
 */
public void draw(Canvas canvas,float posx,float posy){
  posx+=getXOffset();
  posy+=getYOffset();
  canvas.translate(posx,posy);
  draw(canvas);
  canvas.translate(-posx,-posy);
}
Program: 26855
Project: 26855
Buggy source:
/** 
 * returns the y-offset that is set for the MarkerView
 * @return
 */
public float getYOffset(){
  return mYOffset;
}

Fixed version (ground truth):
/** 
 * Use this to return the desired position offset you wish the MarkerView to have on the y-axis. By returning -getHeight() you will cause the MarkerView to be above the selected value.
 * @return
 */
public abstract int getYOffset();
Program: 26856
Project: 26856
Buggy source:
/** 
 * sets the size of the description text in pixels, min 7f, max 14f
 * @param size
 */
public void setDescriptionTextSize(float size){
  if (size > 14f)   size=14f;
  if (size < 7f)   size=7f;
  mInfoPaint.setTextSize(Utils.convertDpToPixel(size));
}

Fixed version (ground truth):
/** 
 * sets the size of the description text in pixels, min 6f, max 16f
 * @param size
 */
public void setDescriptionTextSize(float size){
  if (size > 16f)   size=16f;
  if (size < 6f)   size=6f;
  mDescPaint.setTextSize(Utils.convertDpToPixel(size));
}
Program: 26857
Project: 26857
Buggy source:
/** 
 * Returns the DataSet object with the given label. Search can be case sensitive or not. IMPORTANT: This method does calculations at runtime. Use with care in performance critical situations.
 * @param label
 * @param ignorecase
 * @return
 */
public T getDataSetByLabel(String label,boolean ignorecase){
  int index=getDataSetIndexByLabel(mDataSets,label,ignorecase);
  if (index <= 0 || index >= mDataSets.size())   return null;
 else   return mDataSets.get(index);
}

Fixed version (ground truth):
/** 
 * Returns the DataSet object with the given label. Search can be case sensitive or not. IMPORTANT: This method does calculations at runtime. Use with care in performance critical situations.
 * @param label
 * @param ignorecase
 * @return
 */
public T getDataSetByLabel(String label,boolean ignorecase){
  int index=getDataSetIndexByLabel(mDataSets,label,ignorecase);
  if (index < 0 || index >= mDataSets.size())   return null;
 else   return mDataSets.get(index);
}
Program: 26858
Project: 26858
Buggy source:
/** 
 * Sets the offsets from the border of the view to the actual chart in every direction manually. Provide density pixels -> they are then rendered to pixels inside the chart
 * @param left
 * @param right
 * @param top
 * @param bottom
 */
public void setOffsets(float left,float top,float right,float bottom){
  mOffsetBottom=Utils.convertDpToPixel(bottom);
  mOffsetLeft=Utils.convertDpToPixel(left);
  mOffsetRight=Utils.convertDpToPixel(right);
  mOffsetTop=Utils.convertDpToPixel(top);
}

Fixed version (ground truth):
/** 
 * Sets the offsets from the border of the view to the actual chart in every direction manually. This method needs to be recalled everytime a new data object is set for the chart. Provide density pixels -> they are then rendered to pixels inside the chart.
 * @param left
 * @param right
 * @param top
 * @param bottom
 */
public void setOffsets(float left,float top,float right,float bottom){
  mOffsetBottom=Utils.convertDpToPixel(bottom);
  mOffsetLeft=Utils.convertDpToPixel(left);
  mOffsetRight=Utils.convertDpToPixel(right);
  mOffsetTop=Utils.convertDpToPixel(top);
  mTrans.prepareMatrixValuePx(this);
  mTrans.prepareMatrixOffset(this);
  prepareContentRect();
}
Program: 26859
Project: 26859
Buggy source:
/** 
 * Returns the center of the chart taking offsets under consideration. (returns the center of the content rectangle)
 * @return
 */
public PointF getCenterOffsets(){
  return new PointF(mContentRect.centerX(),mContentRect.centerY());
}

Fixed version (ground truth):
/** 
 * Returns the center of the chart taking offsets under consideration. (returns the center of the content rectangle)
 * @return
 */
@Override public PointF getCenterOffsets(){
  return new PointF(mContentRect.centerX(),mContentRect.centerY());
}
Program: 26861
Project: 26861
Buggy source:
/** 
 * calculates the average length (in characters) across all x-value strings
 */
private void calcXValAverageLength(){
  if (mXVals.size() == 0) {
    mXValAverageLength=1;
    return;
  }
  float sum=0f;
  for (int i=0; i < mXVals.size(); i++) {
    sum+=mXVals.get(i).length();
  }
  mXValAverageLength=sum / (float)mXVals.size();
}

Fixed version (ground truth):
/** 
 * calculates the average length (in characters) across all x-value strings
 */
private void calcXValAverageLength(){
  if (mXVals.size() == 0) {
    mXValAverageLength=1;
    return;
  }
  float sum=1f;
  for (int i=0; i < mXVals.size(); i++) {
    sum+=mXVals.get(i).length();
  }
  mXValAverageLength=sum / (float)mXVals.size();
}
Program: 26863
Project: 26863
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
}

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(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) - 50;
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
}
Program: 26865
Project: 26865
Buggy source:
/** 
 * Draws a value at the specified x and y position.
 * @param value
 * @param xPos
 * @param yPos
 */
private void drawValue(String val,float xPos,float yPos){
  if (mDrawUnitInChart) {
    mDrawCanvas.drawText(val + mUnit,xPos,yPos,mValuePaint);
  }
 else {
    mDrawCanvas.drawText(val,xPos,yPos,mValuePaint);
  }
}

Fixed version (ground truth):
/** 
 * Draws a value at the specified x and y position.
 * @param value
 * @param xPos
 * @param yPos
 */
private void drawValue(float val,float xPos,float yPos){
  String value=mValueFormatter.getFormattedValue(val);
  if (mDrawUnitInChart) {
    mDrawCanvas.drawText(value + mUnit,xPos,yPos,mValuePaint);
  }
 else {
    mDrawCanvas.drawText(value,xPos,yPos,mValuePaint);
  }
}
Program: 26867
Project: 26867
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) - 50;
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
}

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(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
}
Program: 26868
Project: 26868
Buggy source:
public MyMarkerView(Context context,int layoutResource){
  super(context,layoutResource);
  tvContent=(TextView)findViewById(R.id.tvContent);
}

Fixed version (ground truth):
public MyMarkerView(Context context,int layoutResource){
  super(context,layoutResource);
  tvContent=(TextView)findViewById(R.id.tvContent);
  setOnClickListener(this);
}
Program: 26869
Project: 26869
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (mListener == null || mDataNotSet)   return false;
  if (!mTouchEnabled)   return false;
 else   return mListener.onTouch(this,event);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  super.onTouchEvent(event);
  if (mListener == null || mDataNotSet)   return false;
  if (!mTouchEnabled)   return false;
 else   return mListener.onTouch(this,event);
}
Program: 26870
Project: 26870
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
  mDrawCanvas=new Canvas(mDrawBitmap);
  prepareContentRect();
  prepare();
  super.onSizeChanged(w,h,oldw,oldh);
}