Does library support using List instead of float array?
pkhivesara opened this issue · 4 comments
pkhivesara commented
I have the following code in my app. However i see nothing being drawn. I do see the list being populated correctly. Any input is appreciated.
List<Float> dataSetForLineGraph;
public DetailsFragmentLineGraphAdapter(List<Float> dataSetForLineGraph) {
this.dataSetForLineGraph = dataSetForLineGraph;
}
@Override
public int getCount() {
return dataSetForLineGraph.size();
}
@Override
public Object getItem(int index) {
//Log.e("###",Float.toString(dataSetForLineGraph[index]));
return dataSetForLineGraph.get(index);
}
@Override
public float getY(int index) {
// Log.e("@@@",Float.toString(dataSetForLineGraph[index]));
return dataSetForLineGraph.get(index);
}
}
And this is my xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.robinhood.spark.SparkView
android:id="@+id/sparkView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
naturalwarren commented
Did you plug the adapter into SparkView
? I don't see anything wrong with what you've pasted.
pkhivesara commented
Yea i did.
mDetailsFragment = new DetailsGraphAdapter(dataSet);
sparkView.setAdapter(mGraphAdapter);
naturalwarren commented
🤔 In one of my projects I back my adapter with a list - no troubles.
If you want to provide a small sample project that reproduces the problem I'd be happy to take a look.
pkhivesara commented
Sorry for the delay. The issue was because of an inconsistency on the data side that i was passing. Closing the issue. Thanks.