nus-yam/ex-repair huggingface dataset:
Program: 18756
Project: 18756
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_horizontalbarchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mChart=(HorizontalBarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawBarShadow(false);
  mChart.setDrawValueAboveBar(true);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawHorizontalGrid(true);
  mChart.setDrawVerticalGrid(false);
  mChart.setValueTextSize(10f);
  mChart.setDrawBorder(false);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis xl=mChart.getXAxis();
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  YAxis yl=mChart.getAxisLeft();
  yl.setTypeface(tf);
  yl.setLabelCount(8);
  mChart.setValueTypeface(tf);
  setData(12,50);
  mSeekBarY.setProgress(50);
  mSeekBarX.setProgress(12);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_LEFT);
  l.setFormSize(8f);
  l.setXEntrySpace(4f);
}

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_horizontalbarchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mChart=(HorizontalBarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawBarShadow(false);
  mChart.setDrawValueAboveBar(true);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  mChart.setValueTextSize(10f);
  mChart.setDrawBorder(false);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis xl=mChart.getXAxis();
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  YAxis yl=mChart.getAxisLeft();
  yl.setTypeface(tf);
  yl.setLabelCount(8);
  mChart.setValueTypeface(tf);
  setData(12,50);
  mSeekBarY.setProgress(50);
  mSeekBarX.setProgress(12);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_LEFT);
  l.setFormSize(8f);
  l.setXEntrySpace(4f);
}
Program: 18758
Project: 18758
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(ColorTemplate.getHoloBlue());
  set1.setLineWidth(2f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range / 10);
    float val=(float)(Math.random() * mult) + 500;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.RED);
  set2.setLineWidth(2f);
  set2.setCircleSize(4f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range / 2f;
    float val=(float)(Math.random() * mult) + 50;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(ColorTemplate.getHoloBlue());
  set1.setLineWidth(2f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range;
    float val=(float)(Math.random() * mult) + 450;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.RED);
  set2.setLineWidth(2f);
  set2.setCircleSize(4f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}
Program: 18759
Project: 18759
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.setDrawVerticalGrid(false);
  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);
  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 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);
}
Program: 18760
Project: 18760
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XAxis xl=holder.chart.getXAxis();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YAxis yl=holder.chart.getAxisLeft();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XAxis xl=holder.chart.getXAxis();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  xl.setDrawGridLines(false);
  YAxis yl=holder.chart.getAxisLeft();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}
Program: 18761
Project: 18761
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);
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  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);
  YAxis labels=mChart.getAxisLeft();
  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.setDrawXLabels(false);
  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);
  YAxis labels=mChart.getAxisLeft();
  labels.setTypeface(tf);
  XAxis xAxis=mChart.getXAxis();
  xAxis.setDrawGridLines(false);
  FrameLayout parent=(FrameLayout)v.findViewById(R.id.parentLayout);
  parent.addView(mChart);
  return v;
}
Program: 18762
Project: 18762
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_line,container,false);
  mChart=(LineChart)v.findViewById(R.id.lineChart1);
  mChart.setDescription("String_Node_Str");
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawXLabels(false);
  mChart.setData(getComplexity());
  mChart.animateX(3000);
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  YAxis labels=mChart.getAxisLeft();
  labels.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_line,container,false);
  mChart=(LineChart)v.findViewById(R.id.lineChart1);
  mChart.setDescription("String_Node_Str");
  mChart.setHighlightIndicatorEnabled(false);
  mChart.setDrawBorder(false);
  mChart.setDrawGridBackground(false);
  mChart.setDrawXLabels(false);
  mChart.setData(getComplexity());
  mChart.animateX(3000);
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setTypeface(tf);
  YAxis labels=mChart.getAxisLeft();
  labels.setTypeface(tf);
  XAxis xAxis=mChart.getXAxis();
  xAxis.setDrawGridLines(false);
  return v;
}
Program: 18763
Project: 18763
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: 18764
Project: 18764
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: 18765
Project: 18765
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: 18766
Project: 18766
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: 18767
Project: 18767
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: 18768
Project: 18768
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: 18769
Project: 18769
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: 18771
Project: 18771
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: 18772
Project: 18772
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: 18773
Project: 18773
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: 18774
Project: 18774
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: 18775
Project: 18775
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: 18776
Project: 18776
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: 18777
Project: 18777
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: 18778
Project: 18778
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: 18779
Project: 18779
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: 18781
Project: 18781
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: 18783
Project: 18783
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: 18785
Project: 18785
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: 18787
Project: 18787
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.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.set3DEnabled(false);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawHorizontalGrid(false);
  mChart.setDrawGridBackground(false);
  XLabels xLabels=mChart.getXLabels();
  xLabels.setPosition(XLabelPosition.BOTTOM);
  xLabels.setCenterXLabelText(true);
  xLabels.setSpaceBetweenLabels(0);
  mChart.setDrawYLabels(false);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  mChart.animateY(2500);
}

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.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  mChart.setDescription("String_Node_Str");
  mChart.setDrawYValues(true);
  mChart.setMaxVisibleValueCount(60);
  mChart.set3DEnabled(false);
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawHorizontalGrid(false);
  mChart.setDrawGridBackground(false);
  XLabels xLabels=mChart.getXLabels();
  xLabels.setPosition(XLabelPosition.BOTTOM);
  xLabels.setCenterXLabelText(true);
  xLabels.setSpaceBetweenLabels(0);
  mChart.setDrawYLabels(false);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  mChart.animateY(2500);
}
Program: 18788
Project: 18788
Buggy source:
/** 
 * calculates the required number of digits for the values that might be drawn in the chart (if enabled)
 */
protected void calcFormats(){
  if (!mUseCustomFormatter) {
    float reference=0f;
    if (mOriginalData == null || mOriginalData.getXValCount() < 2) {
      reference=Math.max(Math.abs(mYChartMin),Math.abs(mYChartMax));
    }
 else {
      reference=mDeltaY;
    }
    int digits=Utils.getFormatDigits(reference);
    StringBuffer b=new StringBuffer();
    for (int i=0; i < digits; i++) {
      if (i == 0)       b.append("String_Node_Str");
      b.append("String_Node_Str");
    }
    mValueFormat=new DecimalFormat("String_Node_Str" + b.toString());
  }
}

Fixed version (ground truth):
/** 
 * calculates the required number of digits for the values that might be drawn in the chart (if enabled)
 */
protected void calcFormats(){
  if (!mUseCustomFormatter) {
    float reference=0f;
    if (mOriginalData == null || mOriginalData.getXValCount() < 2) {
      reference=Math.max(Math.abs(mYChartMin),Math.abs(mYChartMax));
    }
 else {
      reference=mDeltaY;
    }
    int digits=Utils.getDecimals(reference);
    StringBuffer b=new StringBuffer();
    for (int i=0; i < digits; i++) {
      if (i == 0)       b.append("String_Node_Str");
      b.append("String_Node_Str");
    }
    mValueFormat=new DecimalFormat("String_Node_Str" + b.toString());
  }
}
Program: 18790
Project: 18790
Buggy source:
@Override protected void drawData(){
  float angle=mRotationAngle;
  ArrayList<PieDataSet> dataSets=mCurrentData.getDataSets();
  int cnt=0;
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    PieDataSet dataSet=dataSets.get(i);
    ArrayList<Entry> entries=dataSet.getYVals();
    for (int j=0; j < entries.size(); j++) {
      float newangle=mDrawAngles[cnt];
      float sliceSpace=dataSet.getSliceSpace();
      if (!needsHighlight(entries.get(j).getXIndex(),i)) {
        mRenderPaint.setColor(dataSet.getColor(j));
        mDrawCanvas.drawArc(mCircleBox,angle + sliceSpace / 2f,newangle * mPhaseY - sliceSpace / 2f,true,mRenderPaint);
      }
      angle+=newangle * mPhaseX;
      cnt++;
    }
  }
}

Fixed version (ground truth):
@Override protected void drawData(){
  float angle=mRotationAngle;
  ArrayList<PieDataSet> dataSets=mCurrentData.getDataSets();
  int cnt=0;
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    PieDataSet dataSet=dataSets.get(i);
    ArrayList<Entry> entries=dataSet.getYVals();
    for (int j=0; j < entries.size(); j++) {
      float newangle=mDrawAngles[cnt];
      float sliceSpace=dataSet.getSliceSpace();
      Entry e=entries.get(j);
      if ((Math.abs(e.getVal()) > 0.000001)) {
        if (!needsHighlight(e.getXIndex(),i)) {
          mRenderPaint.setColor(dataSet.getColor(j));
          mDrawCanvas.drawArc(mCircleBox,angle + sliceSpace / 2f,newangle * mPhaseY - sliceSpace / 2f,true,mRenderPaint);
        }
      }
      angle+=newangle * mPhaseX;
      cnt++;
    }
  }
}
Program: 18791
Project: 18791
Buggy source:
/** 
 * calculates the needed angles for the chart slices
 */
private void calcAngles(){
  mDrawAngles=new float[mCurrentData.getYValCount()];
  mAbsoluteAngles=new float[mCurrentData.getYValCount()];
  ArrayList<PieDataSet> dataSets=mCurrentData.getDataSets();
  int cnt=0;
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    PieDataSet set=dataSets.get(i);
    ArrayList<Entry> entries=set.getYVals();
    for (int j=0; j < entries.size(); j++) {
      mDrawAngles[cnt]=calcAngle(entries.get(j).getVal());
      if (cnt == 0) {
        mAbsoluteAngles[cnt]=mDrawAngles[cnt];
      }
 else {
        mAbsoluteAngles[cnt]=mAbsoluteAngles[cnt - 1] + mDrawAngles[cnt];
      }
      cnt++;
    }
  }
}

Fixed version (ground truth):
/** 
 * calculates the needed angles for the chart slices
 */
private void calcAngles(){
  mDrawAngles=new float[mCurrentData.getYValCount()];
  mAbsoluteAngles=new float[mCurrentData.getYValCount()];
  ArrayList<PieDataSet> dataSets=mCurrentData.getDataSets();
  int cnt=0;
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    PieDataSet set=dataSets.get(i);
    ArrayList<Entry> entries=set.getYVals();
    for (int j=0; j < entries.size(); j++) {
      mDrawAngles[cnt]=calcAngle(Math.abs(entries.get(j).getVal()));
      if (cnt == 0) {
        mAbsoluteAngles[cnt]=mDrawAngles[cnt];
      }
 else {
        mAbsoluteAngles[cnt]=mAbsoluteAngles[cnt - 1] + mDrawAngles[cnt];
      }
      cnt++;
    }
  }
}
Program: 18792
Project: 18792
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);
}