本文整理汇总了Java中com.db.chart.model.BarSet.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java BarSet.setColor方法的具体用法?Java BarSet.setColor怎么用?Java BarSet.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.db.chart.model.BarSet
的用法示例。
在下文中一共展示了BarSet.setColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadChart
import com.db.chart.model.BarSet; //导入方法依赖的package包/类
private void loadChart(float[] data) {
BarSet dataSet = new BarSet();
float tempVal;
for (int index = 0; index < data.length; index++) {
tempVal = data[index];
dataSet.addBar(STATS[index], tempVal);
stats[index].setText(String.valueOf(Math.round(tempVal)));
}
dataSet.setColor(ContextCompat.getColor(context, R.color.colorPrimary));
barChart.addData(dataSet);
barChart.setXAxis(false);
barChart.setYAxis(false);
barChart.setYLabels(AxisRenderer.LabelPosition.NONE);
Animation animation = new Animation(1000);
animation.setInterpolator(new BounceInterpolator());
barChart.show(animation);
}
示例2: onCreate
import com.db.chart.model.BarSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_weekly_timeline);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
initializeData();
initializeRecyclerView(findViewById(R.id.recycler_view));
// String[] testLabels = {"Mon", "Tues", "Wed", "Thurs", "Fri", "Sat", "Sun"};
// float[] testData = {19, 14, 17, 18, 19, 8, 6};
BarSet test = new BarSet();
test.setColor(-10);
barChartView.addData(test);
for (int i = 0; i < items.size(); i++){
Bar bar = new Bar(items.get(i).getDayOfWeek(), items.get(i).getDistance());
if (i % 2 == 0)
bar.setColor(Color.parseColor("#DDDDDD"));
else
bar.setColor(-5);
test.addBar(bar);
}
Animation animation = new Animation(2500);
animation.setEasing(new ElasticEase());
// barChartView.setAxisBorderValues(0, 100, 5);
barChartView.show(animation);
}
示例3: produceThree
import com.db.chart.model.BarSet; //导入方法依赖的package包/类
/**
*
* Chart 3
*
*/
public void produceThree(ChartView chart, Runnable action){
BarChartView barChart = (BarChartView) chart;
Tooltip tip = new Tooltip(BarActivity.this, R.layout.barchart_three_tooltip);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 1);
tip.setEnterAnimation(alpha);
alpha = PropertyValuesHolder.ofFloat(View.ALPHA,0);
tip.setExitAnimation(alpha);
}
barChart.setTooltips(tip);
BarSet dataset = new BarSet(mLabelsThree, mValuesThree);
dataset.setColor(Color.parseColor("#eb993b"));
barChart.addData(dataset);
barChart.setBarSpacing(Tools.fromDpToPx(3));
barChart.setXLabels(AxisController.LabelPosition.NONE)
.setYLabels(AxisController.LabelPosition.NONE)
.setXAxis(false)
.setYAxis(false);
Animation anim = new Animation()
.setEasing(new ElasticEase())
.setEndAction(action);
chart.show(anim);
}
示例4: produceOne
import com.db.chart.model.BarSet; //导入方法依赖的package包/类
public void produceOne(ChartView chart, Runnable action){
if(getActivity()==null) {
return;
}
int currentColor;
int preClor;
preClor=mShowDaily?PRECOLOR:mCurrentColor;
currentColor=mShowDaily?mCurrentColor:PRECOLOR;
prepareStat();
AnimatorUtils.showCardBackgroundColorAnimation(mCardItem, preClor, currentColor, 400);
if(mLables.length<5||mStatValues.length<5) {
return;
}
barChart = (BarChartView) chart;
barChart.setOnEntryClickListener(new OnEntryClickListener() {
@Override
public void onClick(int setIndex, int entryIndex, Rect rect) {
new FinestWebView.Builder(getActivity())
.gradientDivider(false)
.show(mPlayerUrls[entryIndex]);
}
});
Tooltip tooltip = new Tooltip(getActivity(), R.layout.barchart_one_tooltip);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tooltip.setEnterAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 1));
tooltip.setExitAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 0));
}
barChart.setTooltips(tooltip);
BarSet barSet = new BarSet(mLables, mStatValues);
barSet.setColor(preClor);
barChart.addData(barSet);
barChart.setSetSpacing(Tools.fromDpToPx(-15));
barChart.setBarSpacing(Tools.fromDpToPx(20));
barChart.setRoundCorners(Tools.fromDpToPx(4));
gridPaint = new Paint();
gridPaint.setColor(CHART_TEXT_COLOR);
gridPaint.setStyle(Paint.Style.STROKE);
gridPaint.setAntiAlias(true);
gridPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
barChart.setBorderSpacing(5)
.setAxisBorderValues(0, mMax, STEP)
.setGrid(BarChartView.GridType.FULL, mMax, 6, gridPaint)
.setYAxis(false)
.setXLabels(XController.LabelPosition.OUTSIDE)
.setYLabels(YController.LabelPosition.OUTSIDE)
.setLabelsColor(CHART_TEXT_COLOR)
.setAxisColor(CHART_TEXT_COLOR);
int[] order = {2, 1, 3, 0, 4};
final Runnable auxAction = action;
Runnable chartOneAction = new Runnable() {
@Override
public void run() {
showTooltipOne();
auxAction.run();
}
};
barChart.show(new Animation()
.setOverlap(.5f, order)
.setEndAction(chartOneAction));
}