我正在努力创建一个电池使用情况图表。我正在使用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()
?这是正确的方法吗?谢谢