{"action":"created","issue":{"url":"https://api.github.com/repos/robinhood/spark/issues/16","repository_url":"https://api.github.com/repos/robinhood/spark","labels_url":"https://api.github.com/repos/robinhood/spark/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/robinhood/spark/issues/16/comments","events_url":"https://api.github.com/repos/robinhood/spark/issues/16/events","html_url":"https://github.com/robinhood/spark/issues/16","id":161811020,"number":16,"title":"Spark has trouble displaying time-series data","user":{"login":"Azeirah","id":4040870,"avatar_url":"https://avatars.githubusercontent.com/u/4040870?v=3","gravatar_id":"","url":"https://api.github.com/users/Azeirah","html_url":"https://github.com/Azeirah","followers_url":"https://api.github.com/users/Azeirah/followers","following_url":"https://api.github.com/users/Azeirah/following{/other_user}","gists_url":"https://api.github.com/users/Azeirah/gists{/gist_id}","starred_url":"https://api.github.com/users/Azeirah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azeirah/subscriptions","organizations_url":"https://api.github.com/users/Azeirah/orgs","repos_url":"https://api.github.com/users/Azeirah/repos","events_url":"https://api.github.com/users/Azeirah/events{/privacy}","received_events_url":"https://api.github.com/users/Azeirah/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-06-22T23:41:56Z","updated_at":"2016-07-06T22:17:53Z","closed_at":"2016-07-06T21:35:02Z","body":"I've got some data like this, using UNIX timestamps as x-values, and arbitrary values as y-values.\r\n\r\n```json\r\n\"dataPoints\": {\r\n   \"1466546066\": 2.0,\r\n   \"1466546068\": 4.0,\r\n   \"1466546069\": 2.0,\r\n   \"1466546070\": 1.0,\r\n   \"1466546071\": 3.0,\r\n   \"1466546072\": 2.0,\r\n   \"1466546073\": 4.0,\r\n   \"1466546304\": 5.0,\r\n   \"1466546305\": 4.0,\r\n   \"1466546306\": 2.0,\r\n   \"1466546307\": 3.0\r\n}\r\n```\r\n\r\nThe resulting sparkline looks like this, it really shouldn't look like that!\r\n\r\n![sparky](https://cloud.githubusercontent.com/assets/4040870/16287429/3665aace-38e3-11e6-92d8-f8f77c4f6344.png)\r\n\r\nIt could be that I'm doing something wrong, though the sparkline shows correctly when I use indices going from 0-10 instead of using timestamps\r\n\r\nThis is my adapter\r\n\r\n```java\r\npublic class TimedSparkAdapter extends SparkAdapter {\r\n\r\n    private Double[] xData;\r\n    private Double[] yData;\r\n\r\n    public TimedSparkAdapter(Double[] xData, Double[] yData) {\r\n        this.xData = xData;\r\n        this.yData = yData;\r\n    }\r\n\r\n    @Override\r\n    public int getCount() {\r\n        return yData.length;\r\n    }\r\n\r\n    @Override\r\n    public Double getItem(int index) {\r\n        return yData[index];\r\n    }\r\n\r\n    @Override\r\n    public float getY(int index) {\r\n        return yData[index].floatValue();\r\n    }\r\n\r\n    @Override\r\n    public float getX(int index) {\r\n        return xData[index].floatValue();\r\n    }\r\n}\r\n```\r\n\r\nAnd this is what's in my layout\r\n\r\n```xml\r\n    <com.robinhood.spark.SparkView\r\n        android:id=\"@+id/sparkline\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\" />\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/robinhood/spark/issues/comments/230924142","html_url":"https://github.com/robinhood/spark/issues/16#issuecomment-230924142","issue_url":"https://api.github.com/repos/robinhood/spark/issues/16","id":230924142,"user":{"login":"danh32","id":447085,"avatar_url":"https://avatars.githubusercontent.com/u/447085?v=3","gravatar_id":"","url":"https://api.github.com/users/danh32","html_url":"https://github.com/danh32","followers_url":"https://api.github.com/users/danh32/followers","following_url":"https://api.github.com/users/danh32/following{/other_user}","gists_url":"https://api.github.com/users/danh32/gists{/gist_id}","starred_url":"https://api.github.com/users/danh32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danh32/subscriptions","organizations_url":"https://api.github.com/users/danh32/orgs","repos_url":"https://api.github.com/users/danh32/repos","events_url":"https://api.github.com/users/danh32/events{/privacy}","received_events_url":"https://api.github.com/users/danh32/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T22:17:53Z","updated_at":"2016-07-06T22:17:53Z","body":"This seems outside of the scope of Spark to me, since it's no longer a sparkline chart. I also don't think many apps that use Spark would want this behavior. And as you mentioned, detecting this case reliably is quite difficult.\r\n\r\nI think Spark should maintain the current behavior, and apps can use custom logic in their SparkAdapters to massage the data however they might want."}}
{"actor":{"display_login":"danh32"}}