Open marosseleng opened 5 years ago
I have "large" dataset containing pairs of values, that go like [0;1], [1;2], [2;3], etc, up until [19;20]. I am using ViewModel to load those for me and then, I am observing LiveData. The code I have:
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { val view = inflater.inflate(R.layout.fragment_measurement_detail, container, false) pointsSeries = PointsGraphSeries( arrayOf() ) view.findViewById<GraphView>(R.id.graph).addSeries(pointsSeries) return view }
where pointsSeries is a class property, then in onActivityCreated I observe the viewModel:
pointsSeries
onActivityCreated
viewModel.graphValues.observe(this, Observer { // `it` is Pair<Double, Double>, eg. values [0;1], [1;2], ... pointsSeries.resetData(it.map { (fst, snd) -> DataPoint(fst, snd) }.toTypedArray()) })
When I use the code like this, I get this output: (as you can see, I have only 9 points plotted).
However, when I fill series in onCreateView (manually with those 20 pairs), all of them are plotted:
onCreateView
I even set viewport's scalable and scrollable to false but nothing worked.
viewport
scalable
scrollable
false
Is this the correct behavior? Am I missing something? GraphView version 4.2.2
Thanks
Hello? Anybody here?
I have "large" dataset containing pairs of values, that go like [0;1], [1;2], [2;3], etc, up until [19;20]. I am using ViewModel to load those for me and then, I am observing LiveData. The code I have:
where
pointsSeries
is a class property, then inonActivityCreated
I observe the viewModel:When I use the code like this, I get this output: (as you can see, I have only 9 points plotted).
However, when I fill series in
onCreateView
(manually with those 20 pairs), all of them are plotted:I even set
viewport
'sscalable
andscrollable
tofalse
but nothing worked.Is this the correct behavior? Am I missing something? GraphView version 4.2.2
Thanks