• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StaticLabelsFormatter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



StaticLabelsFormatter类属于com.jjoe64.graphview.helper包,在下文中一共展示了StaticLabelsFormatter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configGraphic

import com.jjoe64.graphview.helper.StaticLabelsFormatter; //导入依赖的package包/类
private void configGraphic() {
    series = new LineGraphSeries<>(graphicUtils.getDataPoints(getApplicationContext(), ExpenseDAO.getNoFilter()));
    series.setTitle(getString(R.string.total));
    series.setColor(Color.RED);
    graph.addSeries(series);

    graph.setTitle(getString(R.string.title_graphic));

    graph.getViewport().setMinY(0);
    graph.getViewport().setYAxisBoundsManual(true);

    graph.getLegendRenderer().setVisible(true);
    graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);

    StaticLabelsFormatter labels = new GraphicUtils().getLabels(graph);
    graph.getGridLabelRenderer().setLabelFormatter(labels);
}
 
开发者ID:luankevinferreira,项目名称:expenses,代码行数:18,代码来源:MainActivity.java


示例2: getLabels

import com.jjoe64.graphview.helper.StaticLabelsFormatter; //导入依赖的package包/类
public StaticLabelsFormatter getLabels(GraphView graph) {
    String[] labels = getStringsLabels(Calendar.getInstance());

    StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graph);
    staticLabelsFormatter.setHorizontalLabels(labels);

    return staticLabelsFormatter;
}
 
开发者ID:luankevinferreira,项目名称:expenses,代码行数:9,代码来源:GraphicUtils.java


示例3: createCompletionGraph

import com.jjoe64.graphview.helper.StaticLabelsFormatter; //导入依赖的package包/类
/**
 * Creates the completion metrics graph for the habit
 */
private void createCompletionGraph() {

    int startedWeeksAgo = DateUtil.WeekDifference(habit.getStartDate(), DateTime.now());
    if (startedWeeksAgo > 3) startedWeeksAgo = 3;

    Double runningTotal = 0.00;
    Double[] runningAverages = new Double[4];
    for (int i = -1 * startedWeeksAgo; i <= 0; i++) {
        runningTotal += completionMetrics.get(3+i);
        runningAverages[3+i] = runningTotal/(startedWeeksAgo + i + 1);
    }

    ArrayList<DataPoint> dataPoints = new ArrayList<>();
    for (int i = -1 * startedWeeksAgo; i <= 0; i++) {
        if(runningAverages[3+i] == null) runningAverages[3+i] = 0.00;
        dataPoints.add(new DataPoint(i, runningAverages[3+i]));
    }

    if(dataPoints.size() == 1) {
        dataPoints.add(new DataPoint(-1, 0.0));
        Collections.reverse(dataPoints);
    }

    //habit.setCompletionRate(runningAverages[3]);
    //habitRepository.update(habit.getKey(), habit);

    GraphView graph = (GraphView) findViewById(R.id.graph);
    graph.removeAllSeries();
    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints.toArray(new DataPoint[dataPoints.size()]));

    series.setTitle("Completion Metrics");
    series.setColor(Color.RED);

    graph.getViewport().setMinX(-3);
    graph.getViewport().setMaxX(0);
    graph.getViewport().setMinY(0);
    graph.getViewport().setMaxY(100);

    graph.getViewport().setYAxisBoundsManual(true);
    graph.getViewport().setXAxisBoundsManual(true);

    String[] xLabels = new String[4];
    ArrayList<Week> pastNWeeks = DateUtil.GetNPastWeeks(DateTime.now(), 4);
    for (int i = 0; i < 4; i++) {
        xLabels[i] = pastNWeeks.get(i).getStartOfWeek().toString("MMM d");
    }

    // use static labels for horizontal and vertical labels
    StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graph);
    staticLabelsFormatter.setVerticalLabels(new String[] {"0%","20%","40%","60%","80%","100%"});
    staticLabelsFormatter.setHorizontalLabels(xLabels);

    graph.setTitle("Events completed over last 4 weeks");
    int bgColor = (15 & 0xff) << 24 | (0xD3 & 0xff) << 16 | (0x2F & 0xff) << 8 | (0x2F & 0xff);
    graph.getViewport().setBackgroundColor(bgColor);

    graph.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter);
    graph.getGridLabelRenderer().setHighlightZeroLines(false);
    graph.getGridLabelRenderer().setNumHorizontalLabels(4);
    graph.getGridLabelRenderer().setNumVerticalLabels(6);

    graph.addSeries(series);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:67,代码来源:ViewHabitActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PointPlacement类代码示例发布时间:2022-05-22
下一篇:
Java EmojiconEditText类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap