nus-yam/ex-repair huggingface dataset:
Program: 26579
Project: 26579
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData data=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();
  }
  data.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  data.setValueTextColor(Color.WHITE);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTTOM);
  xAxis.setTypeface(mTf);
  xAxis.setDrawGridLines(false);
  YAxis leftAxis=holder.chart.getAxisLeft();
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(5);
  leftAxis.setSpaceTop(15f);
  YAxis rightAxis=holder.chart.getAxisRight();
  rightAxis.setTypeface(mTf);
  rightAxis.setLabelCount(5);
  rightAxis.setSpaceTop(15f);
  holder.chart.setData(data);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData data=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();
  }
  data.setValueTypeface(mTf);
  data.setValueTextColor(Color.BLACK);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTTOM);
  xAxis.setTypeface(mTf);
  xAxis.setDrawGridLines(false);
  YAxis leftAxis=holder.chart.getAxisLeft();
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(5);
  leftAxis.setSpaceTop(15f);
  YAxis rightAxis=holder.chart.getAxisRight();
  rightAxis.setTypeface(mTf);
  rightAxis.setLabelCount(5);
  rightAxis.setSpaceTop(15f);
  holder.chart.setData(data);
  holder.chart.animateY(700);
  return convertView;
}
Program: 26580
Project: 26580
Buggy source:
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null || data.getYValCount() <= 0) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}
Program: 26584
Project: 26584
Buggy source:
/** 
 * Moves the left side of the current viewport to the specified x-index.
 * @param xIndex
 */
public void moveViewToX(int xIndex){
  float[] pts=new float[]{xIndex,0f};
  getTransformer(AxisDependency.LEFT).pointValuesToPixel(pts);
  mViewPortHandler.centerViewPort(pts,this);
}

Fixed version (ground truth):
/** 
 * Moves the left side of the current viewport to the specified x-index.
 * @param xIndex
 */
public void moveViewToX(float xIndex){
  Runnable job=new MoveViewJob(mViewPortHandler,xIndex,0f,getTransformer(AxisDependency.LEFT),this);
  if (mViewPortHandler.hasChartDimens()) {
    post(job);
  }
 else {
    mJobs.add(job);
  }
}
Program: 26585
Project: 26585
Buggy source:
/** 
 * Centers the viewport to the specified y-value on the y-axis.
 * @param yValue
 * @param axis - which axis should be used as a reference for the y-axis
 */
public void moveViewToY(float yValue,AxisDependency axis){
  float valsInView=getDeltaY(axis) / mViewPortHandler.getScaleY();
  float[] pts=new float[]{0f,yValue + valsInView / 2f};
  getTransformer(axis).pointValuesToPixel(pts);
  mViewPortHandler.centerViewPort(pts,this);
}

Fixed version (ground truth):
/** 
 * Centers the viewport to the specified y-value on the y-axis.
 * @param yValue
 * @param axis - which axis should be used as a reference for the y-axis
 */
public void moveViewToY(float yValue,AxisDependency axis){
  float valsInView=getDeltaY(axis) / mViewPortHandler.getScaleY();
  Runnable job=new MoveViewJob(mViewPortHandler,0f,yValue + valsInView / 2f,getTransformer(axis),this);
  if (mViewPortHandler.hasChartDimens()) {
    post(job);
  }
 else {
    mJobs.add(job);
  }
}
Program: 26586
Project: 26586
Buggy source:
/** 
 * This will move the left side of the current viewport to the specified x-index on the x-axis, and center the viewport to the specified y-value on the y-axis.
 * @param xIndex
 * @param yValue
 * @param axis - which axis should be used as a reference for the y-axis
 */
public void moveViewTo(int xIndex,float yValue,AxisDependency axis){
  float valsInView=getDeltaY(axis) / mViewPortHandler.getScaleY();
  float[] pts=new float[]{xIndex,yValue + valsInView / 2f};
  getTransformer(axis).pointValuesToPixel(pts);
  mViewPortHandler.centerViewPort(pts,this);
}

Fixed version (ground truth):
/** 
 * This will move the left side of the current viewport to the specified x-index on the x-axis, and center the viewport to the specified y-value on the y-axis.
 * @param xIndex
 * @param yValue
 * @param axis - which axis should be used as a reference for the y-axis
 */
public void moveViewTo(float xIndex,float yValue,AxisDependency axis){
  float valsInView=getDeltaY(axis) / mViewPortHandler.getScaleY();
  Runnable job=new MoveViewJob(mViewPortHandler,xIndex,yValue + valsInView / 2f,getTransformer(axis),this);
  if (mViewPortHandler.hasChartDimens()) {
    post(job);
  }
 else {
    mJobs.add(job);
  }
}
Program: 26587
Project: 26587
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
  }
  notifyDataSetChanged();
  super.onSizeChanged(w,h,oldw,oldh);
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
    for (    Runnable r : mJobs) {
      post(r);
    }
    mJobs.clear();
  }
  notifyDataSetChanged();
  super.onSizeChanged(w,h,oldw,oldh);
}
Program: 26588
Project: 26588
Buggy source:
/** 
 * Centers the viewport around the specified position (x-index and y-value) in the chart. Centering the viewport outside the bounds of the chart is not possible. Makes most sense in combination with the setScaleMinima(...) method.
 * @param pts the position to center view viewport to
 * @param chart
 * @return save
 */
public synchronized void centerViewPort(final float[] transformedPts,final Chart<?> chart){
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  final float x=transformedPts[0] - offsetLeft();
  final float y=transformedPts[1] - offsetTop();
  save.postTranslate(-x,-y);
  refresh(save,chart,false);
}

Fixed version (ground truth):
/** 
 * Centers the viewport around the specified position (x-index and y-value) in the chart. Centering the viewport outside the bounds of the chart is not possible. Makes most sense in combination with the setScaleMinima(...) method.
 * @param pts the position to center view viewport to
 * @param chart
 * @return save
 */
public synchronized void centerViewPort(final float[] transformedPts,final View view){
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  final float x=transformedPts[0] - offsetLeft();
  final float y=transformedPts[1] - offsetTop();
  Log.i("String_Node_Str","String_Node_Str" + x + "String_Node_Str"+ y);
  save.postTranslate(-x,-y);
  refresh(save,view,false);
}
Program: 26589
Project: 26589
Buggy source:
/** 
 * call this method to refresh the graph with a given matrix
 * @param newMatrix
 * @return
 */
public Matrix refresh(Matrix newMatrix,Chart<?> chart,boolean invalidate){
  mMatrixTouch.set(newMatrix);
  limitTransAndScale(mMatrixTouch,mContentRect);
  chart.invalidate();
  newMatrix.set(mMatrixTouch);
  return newMatrix;
}

Fixed version (ground truth):
/** 
 * call this method to refresh the graph with a given matrix
 * @param newMatrix
 * @return
 */
public Matrix refresh(Matrix newMatrix,View chart,boolean invalidate){
  mMatrixTouch.set(newMatrix);
  limitTransAndScale(mMatrixTouch,mContentRect);
  chart.invalidate();
  newMatrix.set(mMatrixTouch);
  return newMatrix;
}
Program: 26591
Project: 26591
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);
  data.setValueTextSize(10f);
  data.setValueTypeface(mTf);
  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 - 1; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  yVals1.add(new BarEntry(-20f,count - 1));
  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);
  data.setValueTextSize(10f);
  data.setValueTypeface(mTf);
  mChart.setData(data);
}
Program: 26595
Project: 26595
Buggy source:
/** 
 * Prepares a bar for being highlighted.
 * @param x the x-position
 * @param y the y-position
 * @param barspace the space between bars
 * @param from
 * @param trans
 */
protected void prepareBarHighlight(float x,float y,float barspace,float from,Transformer trans){
  float barWidth=0.5f;
  float spaceHalf=barspace / 2f;
  float left=x - barWidth + spaceHalf;
  float right=x + barWidth - spaceHalf;
  float top=y >= from ? y : from;
  float bottom=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
/** 
 * Prepares a bar for being highlighted.
 * @param x the x-position
 * @param y the y-position
 * @param barspace the space between bars
 * @param from
 * @param trans
 */
protected void prepareBarHighlight(float x,float y,float barspaceHalf,float from,Transformer trans){
  float barWidth=0.5f;
  float left=x - barWidth + barspaceHalf;
  float right=x + barWidth - barspaceHalf;
  float top=y >= from ? y : from;
  float bottom=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}
Program: 26597
Project: 26597
Buggy source:
@Override protected void prepareBarHighlight(float x,float y,float barspace,float from,Transformer trans){
  float spaceHalf=barspace / 2f;
  float top=x - 0.5f + spaceHalf;
  float bottom=x + 0.5f - spaceHalf;
  float left=y >= from ? y : from;
  float right=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
@Override protected void prepareBarHighlight(float x,float y,float barspaceHalf,float from,Transformer trans){
  float top=x - 0.5f + barspaceHalf;
  float bottom=x + 0.5f - barspaceHalf;
  float left=y >= from ? y : from;
  float right=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixelHorizontal(mBarRect,mAnimator.getPhaseY());
}
Program: 26598
Project: 26598
Buggy source:
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
    if (!mYAxis.isInverted()) {
      yMin=(float)p2.y;
      yMax=(float)p1.y;
    }
 else {
      if (!mYAxis.isStartAtZeroEnabled()) {
        yMin=(float)Math.min(p1.y,p2.y);
      }
 else       yMin=0;
      yMax=(float)Math.max(p1.y,p2.y);
    }
  }
  computeAxisValues(yMin,yMax);
}

Fixed version (ground truth):
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
    if (!mYAxis.isInverted()) {
      yMin=(float)p2.y;
      yMax=(float)p1.y;
    }
 else {
      yMin=(float)p1.y;
      yMax=(float)p2.y;
    }
  }
  computeAxisValues(yMin,yMax);
}
Program: 26599
Project: 26599
Buggy source:
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),mViewPortHandler.contentTop());
    if (!mYAxis.isInverted()) {
      yMin=(float)p1.x;
      yMax=(float)p2.x;
    }
 else {
      if (!mYAxis.isStartAtZeroEnabled())       yMin=(float)Math.min(p1.x,p2.x);
 else       yMin=0;
      yMax=(float)Math.max(p1.x,p2.x);
    }
  }
  computeAxisValues(yMin,yMax);
}

Fixed version (ground truth):
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),mViewPortHandler.contentTop());
    if (!mYAxis.isInverted()) {
      yMin=(float)p1.x;
      yMax=(float)p2.x;
    }
 else {
      yMin=(float)p2.x;
      yMax=(float)p1.x;
    }
  }
  computeAxisValues(yMin,yMax);
}
Program: 26601
Project: 26601
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_pie,container,false);
  mChart=(PieChart)v.findViewById(R.id.pieChart1);
  mChart.setDescription("String_Node_Str");
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str"));
  mChart.setCenterText("String_Node_Str");
  mChart.setCenterTextSize(22f);
  mChart.setHoleRadius(45f);
  mChart.setTransparentCircleRadius(50f);
  mChart.setData(generatePieData());
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_pie,container,false);
  mChart=(PieChart)v.findViewById(R.id.pieChart1);
  mChart.setDescription("String_Node_Str");
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  mChart.setCenterTextTypeface(tf);
  mChart.setCenterText("String_Node_Str");
  mChart.setCenterTextSize(22f);
  mChart.setCenterTextTypeface(tf);
  mChart.setHoleRadius(45f);
  mChart.setTransparentCircleRadius(50f);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  mChart.setData(generatePieData());
  return v;
}
Program: 26602
Project: 26602
Buggy source:
/** 
 * generates less data (1 DataSet, 4 values)
 * @return
 */
protected PieData generatePieData(){
  int count=4;
  ArrayList<Entry> entries1=new ArrayList<Entry>();
  ArrayList<String> xVals=new ArrayList<String>();
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  for (int i=0; i < count; i++) {
    xVals.add("String_Node_Str" + (i + 1));
    entries1.add(new Entry((float)(Math.random() * 60) + 40,i));
  }
  PieDataSet ds1=new PieDataSet(entries1,"String_Node_Str");
  ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
  ds1.setSliceSpace(2f);
  PieData d=new PieData(xVals,ds1);
  d.setValueTypeface(tf);
  return d;
}

Fixed version (ground truth):
/** 
 * generates less data (1 DataSet, 4 values)
 * @return
 */
protected PieData generatePieData(){
  int count=4;
  ArrayList<Entry> entries1=new ArrayList<Entry>();
  ArrayList<String> xVals=new ArrayList<String>();
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  for (int i=0; i < count; i++) {
    xVals.add("String_Node_Str" + (i + 1));
    entries1.add(new Entry((float)(Math.random() * 60) + 40,i));
  }
  PieDataSet ds1=new PieDataSet(entries1,"String_Node_Str");
  ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
  ds1.setSliceSpace(2f);
  ds1.setValueTextColor(Color.WHITE);
  ds1.setValueTextSize(12f);
  PieData d=new PieData(xVals,ds1);
  d.setValueTypeface(tf);
  return d;
}
Program: 26603
Project: 26603
Buggy source:
/** 
 * draws the description text in the center of the pie chart makes most sense when center-hole is enabled
 */
protected void drawCenterText(Canvas c){
  String centerText=mChart.getCenterText();
  if (mChart.isDrawCenterTextEnabled() && centerText != null) {
    PointF center=mChart.getCenterCircleBox();
    String[] lines=centerText.split("String_Node_Str");
    float lineHeight=Utils.calcTextHeight(mCenterTextPaint,lines[0]);
    float linespacing=lineHeight * 0.2f;
    float totalheight=lineHeight * lines.length - linespacing * (lines.length - 1);
    int cnt=lines.length;
    float y=center.y;
    for (int i=0; i < lines.length; i++) {
      String line=lines[lines.length - i - 1];
      c.drawText(line,center.x,y + lineHeight * cnt - totalheight / 2f,mCenterTextPaint);
      cnt--;
      y-=linespacing;
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the description text in the center of the pie chart makes most sense when center-hole is enabled
 */
protected void drawCenterText(Canvas c){
  String centerText=mChart.getCenterText();
  if (mChart.isDrawCenterTextEnabled() && centerText != null) {
    PointF center=mChart.getCenterCircleBox();
    String[] lines=centerText.split("String_Node_Str");
    float maxlineheight=0f;
    for (    String line : lines) {
      float curHeight=Utils.calcTextHeight(mCenterTextPaint,line);
      if (curHeight > maxlineheight)       maxlineheight=curHeight;
    }
    float linespacing=maxlineheight * 0.25f;
    float totalheight=maxlineheight * lines.length - linespacing * (lines.length - 1);
    int cnt=lines.length;
    float y=center.y;
    for (int i=0; i < lines.length; i++) {
      String line=lines[lines.length - i - 1];
      c.drawText(line,center.x,y + maxlineheight * cnt - totalheight / 2f,mCenterTextPaint);
      cnt--;
      y-=linespacing;
    }
  }
}
Program: 26604
Project: 26604
Buggy source:
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setViewPortOffsets(10,0,10,0);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setForm(LegendForm.CIRCLE);
  l.setFormSize(6f);
  l.setTextColor(Color.WHITE);
  l.setTypeface(mTf);
  chart.getAxisLeft().setEnabled(false);
  chart.getAxisRight().setEnabled(false);
  chart.getXAxis().setEnabled(false);
  chart.animateX(2500);
}

Fixed version (ground truth):
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setViewPortOffsets(10,0,10,0);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setEnabled(false);
  chart.getAxisLeft().setEnabled(false);
  chart.getAxisRight().setEnabled(false);
  chart.getXAxis().setEnabled(false);
  chart.animateX(2500);
}
Program: 26605
Project: 26605
Buggy source:
@Override public void run(){
  mViewPortHandler.restrainViewPort(left,top,right,bottom);
}

Fixed version (ground truth):
@Override public void run(){
  mViewPortHandler.restrainViewPort(left,top,right,bottom);
  prepareOffsetMatrix();
  prepareValuePxMatrix();
}
Program: 26606
Project: 26606
Buggy source:
/** 
 * Sets custom offsets for the current ViewPort (the offsets on the sides of the actual chart window). Setting this will prevent the chart from automatically calculating it's offsets. Use resetViewPortOffsets() to undo this.
 * @param left
 * @param top
 * @param right
 * @param bottom
 */
public void setViewPortOffsets(final float left,final float top,final float right,final float bottom){
  mCustomViewPortEnabled=true;
  post(new Runnable(){
    @Override public void run(){
      mViewPortHandler.restrainViewPort(left,top,right,bottom);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sets custom offsets for the current ViewPort (the offsets on the sides of the actual chart window). Setting this will prevent the chart from automatically calculating it's offsets. Use resetViewPortOffsets() to undo this.
 * @param left
 * @param top
 * @param right
 * @param bottom
 */
public void setViewPortOffsets(final float left,final float top,final float right,final float bottom){
  mCustomViewPortEnabled=true;
  post(new Runnable(){
    @Override public void run(){
      mViewPortHandler.restrainViewPort(left,top,right,bottom);
      prepareOffsetMatrix();
      prepareValuePxMatrix();
    }
  }
);
}
Program: 26607
Project: 26607
Buggy source:
/** 
 * Sets the size of the area (range on the x-axis) that should be maximum visible at once. If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
 * @param xRange
 */
public void setVisibleXRange(float xRange){
  float xScale=mDeltaX / (xRange + 0.01f);
  mViewPortHandler.setMinimumScaleX(xScale);
}

Fixed version (ground truth):
/** 
 * Sets the size of the area (range on the x-axis) that should be maximum visible at once. If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
 * @param xRange
 */
public void setVisibleXRange(float xRange){
  float xScale=mDeltaX / (xRange);
  mViewPortHandler.setMinimumScaleX(xScale);
}
Program: 26608
Project: 26608
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(float xChartMin,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(-xChartMin,-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 xChartMin,float deltaX,float deltaY,float yChartMin){
  float scaleX=(float)((mViewPortHandler.contentWidth()) / deltaX);
  float scaleY=(float)((mViewPortHandler.contentHeight()) / deltaY);
  mMatrixValueToPx.reset();
  mMatrixValueToPx.postTranslate(-xChartMin,-yChartMin);
  mMatrixValueToPx.postScale(scaleX,-scaleY);
}
Program: 26609
Project: 26609
Buggy source:
@Override protected void onDraw(Canvas canvas){
  if (mDataNotSet) {
    canvas.drawText(mNoDataText,getWidth() / 2,getHeight() / 2,mInfoPaint);
    if (!TextUtils.isEmpty(mNoDataTextDescription)) {
      float textOffset=-mInfoPaint.ascent() + mInfoPaint.descent();
      canvas.drawText(mNoDataTextDescription,getWidth() / 2,(getHeight() / 2) + textOffset,mInfoPaint);
    }
    return;
  }
  if (!mOffsetsCalculated) {
    calculateOffsets();
    mOffsetsCalculated=true;
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  if (mDataNotSet || mData == null || mData.getYValCount() <= 0) {
    canvas.drawText(mNoDataText,getWidth() / 2,getHeight() / 2,mInfoPaint);
    if (!TextUtils.isEmpty(mNoDataTextDescription)) {
      float textOffset=-mInfoPaint.ascent() + mInfoPaint.descent();
      canvas.drawText(mNoDataTextDescription,getWidth() / 2,(getHeight() / 2) + textOffset,mInfoPaint);
    }
    return;
  }
  if (!mOffsetsCalculated) {
    calculateOffsets();
    mOffsetsCalculated=true;
  }
}
Program: 26610
Project: 26610
Buggy source:
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null || data.getYValCount() <= 0) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}
Program: 26612
Project: 26612
Buggy source:
/** 
 * callback when a DataSet has been drawn (when lifting the finger) 
 */
@Override public void onDrawFinished(DataSet<?> dataSet){
  Log.i(Chart.LOG_TAG,"String_Node_Str" + dataSet.toSimpleString());
  mChart.getLegendRenderer().computeLegend(mChart.getData(),mChart.getLegend());
}

Fixed version (ground truth):
/** 
 * callback when a DataSet has been drawn (when lifting the finger) 
 */
@Override public void onDrawFinished(DataSet<?> dataSet){
  Log.i(Chart.LOG_TAG,"String_Node_Str" + dataSet.toSimpleString());
  mChart.getLegendRenderer().computeLegend(mChart.getData());
}
Program: 26613
Project: 26613
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet) {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
    return;
  }
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
  }
  if (mRenderer != null)   mRenderer.initBuffers();
  calcMinMax();
  if (mAxisLeft.needsDefaultFormatter())   mAxisLeft.setValueFormatter(mDefaultFormatter);
  if (mAxisRight.needsDefaultFormatter())   mAxisRight.setValueFormatter(mDefaultFormatter);
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum);
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet) {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
    return;
  }
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
  }
  if (mRenderer != null)   mRenderer.initBuffers();
  calcMinMax();
  if (mAxisLeft.needsDefaultFormatter())   mAxisLeft.setValueFormatter(mDefaultFormatter);
  if (mAxisRight.needsDefaultFormatter())   mAxisRight.setValueFormatter(mDefaultFormatter);
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum);
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 26615
Project: 26615
Buggy source:
/** 
 * initialize all paints and stuff
 */
protected void init(){
  setWillNotDraw(false);
  if (android.os.Build.VERSION.SDK_INT < 11)   mAnimator=new ChartAnimator();
 else   mAnimator=new ChartAnimator(new AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      postInvalidate();
    }
  }
);
  Utils.init(getContext().getResources());
  mDefaultFormatter=new DefaultValueFormatter(1);
  mViewPortHandler=new ViewPortHandler();
  mLegend=new Legend();
  mLegendRenderer=new LegendRenderer(mViewPortHandler);
  mRenderPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mRenderPaint.setStyle(Style.FILL);
  mDescPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mDescPaint.setColor(Color.BLACK);
  mDescPaint.setTextAlign(Align.RIGHT);
  mDescPaint.setTextSize(Utils.convertDpToPixel(9f));
  mInfoPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mInfoPaint.setColor(Color.rgb(247,189,51));
  mInfoPaint.setTextAlign(Align.CENTER);
  mInfoPaint.setTextSize(Utils.convertDpToPixel(12f));
  mDrawPaint=new Paint(Paint.DITHER_FLAG);
  if (mLogEnabled)   Log.i("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * initialize all paints and stuff
 */
protected void init(){
  setWillNotDraw(false);
  if (android.os.Build.VERSION.SDK_INT < 11)   mAnimator=new ChartAnimator();
 else   mAnimator=new ChartAnimator(new AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      postInvalidate();
    }
  }
);
  Utils.init(getContext().getResources());
  mDefaultFormatter=new DefaultValueFormatter(1);
  mViewPortHandler=new ViewPortHandler();
  mLegend=new Legend();
  mLegendRenderer=new LegendRenderer(mViewPortHandler,mLegend);
  mRenderPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mRenderPaint.setStyle(Style.FILL);
  mDescPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mDescPaint.setColor(Color.BLACK);
  mDescPaint.setTextAlign(Align.RIGHT);
  mDescPaint.setTextSize(Utils.convertDpToPixel(9f));
  mInfoPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mInfoPaint.setColor(Color.rgb(247,189,51));
  mInfoPaint.setTextAlign(Align.CENTER);
  mInfoPaint.setTextSize(Utils.convertDpToPixel(12f));
  mDrawPaint=new Paint(Paint.DITHER_FLAG);
  if (mLogEnabled)   Log.i("String_Node_Str","String_Node_Str");
}
Program: 26616
Project: 26616
Buggy source:
/** 
 * Returns the Legend object of the chart. This method can be used to customize the automatically generated Legend. IMPORTANT: Since the Legend is generated from data provided by the user (via setData(...) method), this will return NULL if no data has been set for the chart. You need to set data for the chart before calling this method.
 * @return
 */
public Legend getLegend(){
  return mLegend;
}

Fixed version (ground truth):
/** 
 * Returns the Legend object of the chart. This method can be used to get an instance of the legend in order to customize the automatically generated Legend.
 * @return
 */
public Legend getLegend(){
  return mLegend;
}
Program: 26617
Project: 26617
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas);
  drawDescription(canvas);
}
Program: 26618
Project: 26618
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 26619
Project: 26619
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxisLabels(canvas);
  if (mDrawWeb)   mRenderer.drawExtras(canvas);
  mYAxisRenderer.renderLimitLines(canvas);
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxisLabels(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
  drawMarkers(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxisLabels(canvas);
  if (mDrawWeb)   mRenderer.drawExtras(canvas);
  mYAxisRenderer.renderLimitLines(canvas);
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxisLabels(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas);
  drawDescription(canvas);
  drawMarkers(canvas);
}
Program: 26620
Project: 26620
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(mYAxis.mAxisMinimum,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(mYAxis.mAxisMinimum,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 26621
Project: 26621
Buggy source:
/** 
 * draws the description text in the bottom right corner of the chart
 */
protected void drawDescription(Canvas c){
  c.drawText(mDescription,getWidth() - mViewPortHandler.offsetRight() - 10,getHeight() - mViewPortHandler.offsetBottom() - 10,mDescPaint);
}

Fixed version (ground truth):
/** 
 * draws the description text in the bottom right corner of the chart
 */
protected void drawDescription(Canvas c){
  if (!mDescription.equals("String_Node_Str")) {
    c.drawText(mDescription,getWidth() - mViewPortHandler.offsetRight() - 10,getHeight() - mViewPortHandler.offsetBottom() - 10,mDescPaint);
  }
}
Program: 26622
Project: 26622
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f,"String_Node_Str");
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  ll1.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll1.setTextSize(10f);
  LimitLine ll2=new LimitLine(-30f,"String_Node_Str");
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  ll2.setLabelPosition(LimitLabelPosition.POS_RIGHT);
  ll2.setTextSize(10f);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.removeAllLimitLines();
  leftAxis.addLimitLine(ll1);
  leftAxis.addLimitLine(ll2);
  leftAxis.setAxisMaxValue(220f);
  leftAxis.setAxisMinValue(-50f);
  leftAxis.setStartAtZero(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.setData(data);
}
Program: 26624
Project: 26624
Buggy source:
/** 
 * Adds a new LimitLine to this axis.
 * @param l
 */
public void addLimitLine(LimitLine l){
  mLimitLines.add(l);
}

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

Fixed version (ground truth):
/** 
 * Removes all LimitLines from the axis.
 */
public void removeAllLimitLines(){
  mLimitLines.clear();
}
Program: 26628
Project: 26628
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_performance_linechart);
  mTvCount=(TextView)findViewById(R.id.tvValueCount);
  mSeekBarValues=(SeekBar)findViewById(R.id.seekbarValues);
  mTvCount.setText("String_Node_Str");
  mSeekBarValues.setProgress(500);
  mSeekBarValues.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setDrawGridBackground(false);
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(false);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(false);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.getAxisLeft().setDrawGridLines(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.getXAxis().setDrawGridLines(false);
  mChart.getXAxis().setDrawAxisLine(false);
  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_performance_linechart);
  mTvCount=(TextView)findViewById(R.id.tvValueCount);
  mSeekBarValues=(SeekBar)findViewById(R.id.seekbarValues);
  mTvCount.setText("String_Node_Str");
  mSeekBarValues.setProgress(500);
  mSeekBarValues.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setDrawGridBackground(false);
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(false);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(false);
  mChart.setHighlightIndicatorEnabled(false);
  mChart.getAxisLeft().setDrawGridLines(false);
  mChart.getAxisRight().setEnabled(false);
  mChart.getXAxis().setDrawGridLines(true);
  mChart.getXAxis().setDrawAxisLine(false);
  mChart.invalidate();
}
Program: 26629
Project: 26629
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setColor(Color.BLACK);
  set1.setLineWidth(0.5f);
  set1.setDrawValues(false);
  set1.setDrawCircles(false);
  set1.setDrawCubic(false);
  set1.setDrawFilled(true);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
  Legend l=mChart.getLegend();
  l.setEnabled(false);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setColor(Color.BLACK);
  set1.setLineWidth(0.5f);
  set1.setDrawValues(false);
  set1.setDrawCircles(false);
  set1.setDrawCubic(false);
  set1.setDrawFilled(false);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
  Legend l=mChart.getLegend();
  l.setEnabled(false);
}
Program: 26630
Project: 26630
Buggy source:
@Override protected void init(){
  super.init();
  mAxisLeft=new YAxis(AxisDependency.LEFT);
  mAxisRight=new YAxis(AxisDependency.RIGHT);
  mXAxis=new XAxis();
  mLeftAxisTransformer=new Transformer(mViewPortHandler);
  mRightAxisTransformer=new Transformer(mViewPortHandler);
  mAxisRendererLeft=new YAxisRenderer(mViewPortHandler,mAxisLeft,mLeftAxisTransformer);
  mAxisRendererRight=new YAxisRenderer(mViewPortHandler,mAxisRight,mRightAxisTransformer);
  mXAxisRenderer=new XAxisRenderer(mViewPortHandler,mXAxis,mLeftAxisTransformer);
  mListener=new BarLineChartTouchListener(this,mViewPortHandler.getMatrixTouch());
  mGridBackgroundPaint=new Paint();
  mGridBackgroundPaint.setStyle(Style.FILL);
  mGridBackgroundPaint.setColor(Color.rgb(240,240,240));
}

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

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

Fixed version (ground truth):
/** 
 * Removes all DataSets (and thereby Entries) from the chart. Does not remove the x-values. Also refreshes the chart by calling invalidate().
 */
public void clearValues(){
  mData.clearValues();
  invalidate();
}