当前位置: 首页>>代码示例>>Java>>正文


Java BarSet类代码示例

本文整理汇总了Java中com.db.chart.model.BarSet的典型用法代码示例。如果您正苦于以下问题:Java BarSet类的具体用法?Java BarSet怎么用?Java BarSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BarSet类属于com.db.chart.model包,在下文中一共展示了BarSet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:tylerbwong,项目名称:Pokebase,代码行数:20,代码来源:PokemonInfoView.java

示例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);

    }
 
开发者ID:alexdao,项目名称:footstep,代码行数:34,代码来源:WeeklyTimeline.java

示例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);
}
 
开发者ID:Knockathon2017,项目名称:knockathon-scripts-kiddies,代码行数:39,代码来源:BarActivity.java

示例4: onCreate

import com.db.chart.model.BarSet; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data_view);

        this.outputTextView = (TextView) this.findViewById(R.id.outputTextView);

        this.barChartView = (BarChartView) this.findViewById(R.id.barChartView);
        barChartView.setBarBackgroundColor(Color.BLACK);
        barChartView.setBarSpacing(10);
        barChartView.setSetSpacing(10);
        barChartView.setLabelsColor(Color.WHITE);
        barChartView.setAxisColor(Color.GRAY);
        barChartView.setAxisBorderValues(-20, 20, 2);

        this.xBar = new Bar("x", 0.0f);
        this.yBar = new Bar("y", 0.0f);
        this.zBar = new Bar("z", 0.0f);
        this.xBar.setColor(Color.WHITE);
        this.yBar.setColor(Color.WHITE);
        this.zBar.setColor(Color.WHITE);

        BarSet barSet = new BarSet();
        barSet.addBar(xBar);
        barSet.addBar(yBar);
        barSet.addBar(zBar);
        barChartView.addData(barSet);
        barChartView.show();

//        this.accelerometerService.setRawAccelerometerDataListener(new AccelerometerService.RawAccelerometerDataListener() {
//            @Override
//            public void newData(float x, float y, float z) {
//                double avg = Math.sqrt((x * x) + (y * y) + (z * z));
//                String format = String.format("%9.5f, %9.5f, %9.5f, %9.5f\n", x, y, z, avg);
////                outputTextView.append(format);
//
//                xBar.setValue(x);
//                yBar.setValue(y);
//                zBar.setValue(z);
//                barChartView.show();
//
//                PrintWriter pw = fileWriter;
//                if (pw != null) {
//                    pw.write(format);
//                }
//            }
//        });

//        this.fileNameEditText = (EditText) this.findViewById(R.id.fileNameEditText);
//
//        this.recordButton = (Button) this.findViewById(R.id.recordButton);
//        this.recordButton.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                recordButtonPressed();
//            }
//        });

//        Button optionsButton = (Button) this.findViewById(R.id.optionsButton);
//        optionsButton.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                displayOptionsMenu();
//            }
//        });
    }
 
开发者ID:uml-ubicomp-2016-spring,项目名称:ubicomp16-DropApp,代码行数:67,代码来源:DataViewActivity.java

示例5: 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));


}
 
开发者ID:SilenceDut,项目名称:NBAPlus,代码行数:71,代码来源:BarFragment.java


注:本文中的com.db.chart.model.BarSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。