Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally got it. I overrided GraphicalView's onDraw method so that I can extract keys and attach them to my data. It goes something like this:</p> <pre><code>@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.getClipBounds(mRect); int top = mRect.top; int left = mRect.left; int width = mRect.width(); int height = mRect.height(); if (mRenderer.isInScroll()) { top = 0; left = 0; width = getMeasuredWidth(); height = getMeasuredHeight(); } mChart.draw(canvas, left, top, width, height, mPaint); /* * This is where we build the map of &lt;data point, info&gt; */ if (mIsFirstDraw &amp;&amp; mIsAttachData &amp;&amp; mAdditionalPointData != null &amp;&amp; mAdditionalPointData.size() &gt; 0) { // ClickablePoints is an interface that has a method to get the datapoints rendered by ScatterChart List&lt;float[]&gt; pointCoords = ((ClickablePoints) mChart).getDataPointCoords(); mPointKeys = new double[pointCoords.size()]; mAdditionalDataMap = new HashMap&lt;Double, String&gt;(); for (int i = 0, j = mPointKeys.length; i &lt; j; i++) { float[] coords = pointCoords.get(i); SeriesSelection seriesSelection = mChart.getSeriesAndPointForScreenCoordinate( new Point(coords[0], coords[1])); mPointKeys[i] = seriesSelection.getXValue(); mAdditionalDataMap.put(seriesSelection.getXValue(), mAdditionalPointData.get(i)); } mIsFirstDraw = false; } } </code></pre> <p>mIsFirstDraw is a flag that indicates that it is the first time that the graph will be drawn. It needs to be taken down afterwards so that it does not repeat attaching keys to the data.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload