hellocharts-android icon indicating copy to clipboard operation
hellocharts-android copied to clipboard

hello chart 使用 linechart 中 只有一个坐标点如何显示 ????? please Thank you

Open RunRunAllen opened this issue 9 years ago • 5 comments

RunRunAllen avatar Jan 11 '17 09:01 RunRunAllen

给LIneChatView设置以下属性:

//set chart data to initialize viewport, otherwise it will be[0,0;0,0]
//get initialized viewport and change if ranges according to your needs.
final Viewport v = new Viewport(chart.getMaximumViewport());
v.left =100;
v.right = 200;
v.top =20;
v.bottom = 0;
chart.setMaximumViewport(v);
chart.setCurrentViewport(v);
//Optional step: disable viewport recalculations, thanks to this animations will not change viewport automatically.
//chart.setViewportCalculationEnabled(false);`

left、right这些都是数值。 如我想要记录体温,就可以写成

v.top =42;
v.bottom = 35;

lecho大神说 chart.setViewportCalculationEnabled(false); 这句视情况而加。我是不加不行。你试一下

dakun666 avatar Feb 23 '17 19:02 dakun666

我又试了一下,只加 chart.setViewportCalculationEnabled(false); 也可以

dakun666 avatar Feb 23 '17 19:02 dakun666

我发现一个情况,当只有一个点的时候,如果设 Viewport.right = 0,则这个点显示不出来,要把Viewport.right 设为 1 才可以。

setsailz avatar Mar 30 '17 01:03 setsailz

@setsailz 为啥wo'sh我设置的没一点用呢,是顺序问题吗,改了好久还是没用

zxdeer avatar Jan 15 '18 11:01 zxdeer

@dgmltn 为啥没一点效果

zxdeer avatar Jan 15 '18 12:01 zxdeer