|
|
@ -77,8 +77,6 @@ public class BarChart extends ScrollableChart
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
private List<Checkmark> checkmarks;
|
|
|
|
private List<Checkmark> checkmarks;
|
|
|
|
|
|
|
|
|
|
|
|
private int primaryColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int bucketSize = 7;
|
|
|
|
private int bucketSize = 7;
|
|
|
|
|
|
|
|
|
|
|
|
private int backgroundColor;
|
|
|
|
private int backgroundColor;
|
|
|
@ -99,6 +97,10 @@ public class BarChart extends ScrollableChart
|
|
|
|
|
|
|
|
|
|
|
|
private double target;
|
|
|
|
private double target;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int primaryColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int darkerPrimaryColor;
|
|
|
|
|
|
|
|
|
|
|
|
public BarChart(Context context)
|
|
|
|
public BarChart(Context context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
@ -148,7 +150,10 @@ public class BarChart extends ScrollableChart
|
|
|
|
|
|
|
|
|
|
|
|
public void setColor(int primaryColor)
|
|
|
|
public void setColor(int primaryColor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
StyledResources res = new StyledResources(getContext());
|
|
|
|
|
|
|
|
int backgroundColor = res.getColor(R.attr.cardBgColor);
|
|
|
|
this.primaryColor = primaryColor;
|
|
|
|
this.primaryColor = primaryColor;
|
|
|
|
|
|
|
|
this.darkerPrimaryColor = ColorUtils.mixColors(primaryColor, backgroundColor, 0.6f);
|
|
|
|
postInvalidate();
|
|
|
|
postInvalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -271,7 +276,7 @@ public class BarChart extends ScrollableChart
|
|
|
|
float margin = baseSize * 0.225f;
|
|
|
|
float margin = baseSize * 0.225f;
|
|
|
|
float round = dpToPixels(getContext(), 2);
|
|
|
|
float round = dpToPixels(getContext(), 2);
|
|
|
|
|
|
|
|
|
|
|
|
int color = textColor;
|
|
|
|
int color = darkerPrimaryColor;
|
|
|
|
if (value / 1000 >= target) color = primaryColor;
|
|
|
|
if (value / 1000 >= target) color = primaryColor;
|
|
|
|
|
|
|
|
|
|
|
|
rect.inset(-margin, 0);
|
|
|
|
rect.inset(-margin, 0);
|
|
|
@ -364,7 +369,7 @@ public class BarChart extends ScrollableChart
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value == 0) return;
|
|
|
|
if (value == 0) return;
|
|
|
|
|
|
|
|
|
|
|
|
int activeColor = textColor;
|
|
|
|
int activeColor = darkerPrimaryColor;
|
|
|
|
if (value / 1000 >= target)
|
|
|
|
if (value / 1000 >= target)
|
|
|
|
activeColor = primaryColor;
|
|
|
|
activeColor = primaryColor;
|
|
|
|
|
|
|
|
|
|
|
|