Skip to content

Commit

Permalink
Add rounded bar corners, vertical line.
Browse files Browse the repository at this point in the history
  • Loading branch information
Viet Duong committed Mar 3, 2020
1 parent 13b2f68 commit e9007c1
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

package com.github.mikephil.charting.data;

import android.graphics.Color;

import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;

import java.util.List;
Expand All @@ -16,6 +18,12 @@ public class BarData extends BarLineScatterCandleBubbleData<IBarDataSet> {
* the width of the bars on the x-axis, in values (not pixels)
*/
private float mBarWidth = 0.85f;
private boolean isDrawVerticalLine = true;
private boolean isRoundedBarCorners = false;
private float cornerRadius = 10f;
private int startColor = Color.TRANSPARENT;
private int endColor = Color.BLACK;
private int verticalLineColor = Color.BLACK;

public BarData() {
super();
Expand Down Expand Up @@ -116,4 +124,60 @@ public void groupBars(float fromX, float groupSpace, float barSpace) {
public float getGroupWidth(float groupSpace, float barSpace) {
return mDataSets.size() * (mBarWidth + barSpace) + groupSpace;
}

public float getmBarWidth() {
return mBarWidth;
}

public void setmBarWidth(float mBarWidth) {
this.mBarWidth = mBarWidth;
}

public boolean isDrawVerticalLine() {
return isDrawVerticalLine;
}

public void setDrawVerticalLine(boolean drawVerticalLine) {
isDrawVerticalLine = drawVerticalLine;
}

public boolean isRoundedBarCorners() {
return isRoundedBarCorners;
}

public void setRoundedBarCorners(boolean enable) {
isRoundedBarCorners = enable;
}

public float getCornerRadius() {
return cornerRadius;
}

public void setCornerRadius(float cornerRadius) {
this.cornerRadius = cornerRadius;
}

public int getStartColor() {
return startColor;
}

public void setStartColor(int startColor) {
this.startColor = startColor;
}

public int getEndColor() {
return endColor;
}

public void setEndColor(int endColor) {
this.endColor = endColor;
}

public int getVerticalLineColor() {
return verticalLineColor;
}

public void setVerticalLineColor(int verticalLineColor) {
this.verticalLineColor = verticalLineColor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public interface BarDataProvider extends BarLineScatterCandleBubbleDataProvider
boolean isDrawBarShadowEnabled();
boolean isDrawValueAboveBarEnabled();
boolean isHighlightFullBarEnabled();

}
Loading

0 comments on commit e9007c1

Please sign in to comment.