1

我正在创建一个电池使用情况图表。我正在使用 GraphViews 库,并且正在研究它是如何工作的。现在在原始示例代码中有这部分:

exampleSeries1.resetData(new GraphViewData[] {
        new GraphViewData(0, getRandom())
        , new GraphViewData(2, getRandom())
        , new GraphViewData(2.5, getRandom()) // another frequency
        , new GraphViewData(3, getRandom())
        , new GraphViewData(4, getRandom())
        , new GraphViewData(5, getRandom())

我需要的是类似的东西:

exampleSeries1.resetData(new GraphViewData[] {
              new GraphViewData(getTime(), getLevel())
    ,         new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel()) // another frequency
            , new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel())

因为我需要电池电量和时间(当前时间),结果将类似于:

GraphViewData((new GraphViewData[] {
              new GraphViewData(8:00, 80%)
    ,         new GraphViewData(8:01, 80%)
            , new GraphViewData(8:02, 79%) // another frequency
            , new GraphViewData(8:03, 78%)
            , new GraphViewData(8:04, 78%)
            , new GraphViewData(8:05, 77%)

我该怎么做?我怎样才能找到getTime()getLevel()?这是正确的方法吗?谢谢

4

0 回答 0