title: Retrieving data from thingspeak website to HelloCharts
body: <p>In this code data is taken from thingspeak website given the channel id. the channel is public. The graph is obtained using hellocharts and chartview.</p>
  
  <p>QUESTION:
  I want to print all the data values which are plotted on the graph or the last data added in a text view. In which variable is the data stored As i want to further work with the data.</p>
  
  <p><img src="https://i.stack.imgur.com/R7Qb3.png" alt="For the output please see the link"></p>
  
  <p>In the output I want to know that the value 395 is stored in which variable.</p>
  
  <p>I have provided the java code below.</p>
  
  <pre><code>import android.graphics.Color;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.widget.Toast;
  import com.macroyau.thingspeakandroid.ThingSpeakChannel;
  import com.macroyau.thingspeakandroid.ThingSpeakLineChart;
  import com.macroyau.thingspeakandroid.model.ChannelFeed;
  import java.util.Calendar;
  import java.util.Date;
  import lecho.lib.hellocharts.model.LineChartData;
  import lecho.lib.hellocharts.model.Viewport;
  import lecho.lib.hellocharts.view.LineChartView;
  
  public class DemoActivity extends ActionBarActivity {
  
  private ThingSpeakChannel tsChannel;
  private ThingSpeakLineChart tsChart;
  private LineChartView chartView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      // Connect to ThinkSpeak Channel 9
      tsChannel = new ThingSpeakChannel(135855);
      // Set listener for Channel feed update events
      tsChannel.setChannelFeedUpdateListener(new ThingSpeakChannel.ChannelFeedUpdateListener() {
          @Override
          public void onChannelFeedUpdated(long channelId, String channelName, ChannelFeed channelFeed) {
              // Show Channel ID and name on the Action Bar
              getSupportActionBar().setTitle(channelName);
              getSupportActionBar().setSubtitle("Channel " + channelId);
              // Notify last update time of the Channel feed through a Toast message
              Date lastUpdate = channelFeed.getChannel().getUpdatedAt();
              Toast.makeText(DemoActivity.this, lastUpdate.toString(), Toast.LENGTH_LONG).show();
          }
      });
      // Fetch the specific Channel feed
      tsChannel.loadChannelFeed();
  
      // Create a Calendar object dated 5 minutes ago
      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.MINUTE, -5);
  
      // Configure LineChartView
      chartView = (LineChartView) findViewById(R.id.chart);
      chartView.setZoomEnabled(false);
      chartView.setValueSelectionEnabled(true);
  
      // Create a line chart from Field1 of ThinkSpeak Channel 9
      tsChart = new ThingSpeakLineChart(135855, 2);
      // Get 200 entries at maximum
      tsChart.setNumberOfEntries(200);
      // Set value axis labels on 10-unit interval
      tsChart.setValueAxisLabelInterval(10);
      // Set date axis labels on 5-minute interval
      tsChart.setDateAxisLabelInterval(10);
      // Show the line as a cubic spline
      tsChart.useSpline(true);
      // Set the line color
      tsChart.setLineColor(Color.parseColor("#D32F2F"));
      // Set the axis color
      tsChart.setAxisColor(Color.parseColor("#455a64"));
      // Set the starting date (5 minutes ago) for the default viewport of the chart
     // tsChart.setChartStartDate(calendar.getTime());
      // Set listener for chart data update
      tsChart.setListener(new ThingSpeakLineChart.ChartDataUpdateListener() {
          @Override
          public void onChartDataUpdated(long channelId, int fieldId, String title, LineChartData lineChartData, Viewport maxViewport, Viewport initialViewport) {
              // Set chart data to the LineChartView
              chartView.setLineChartData(lineChartData);
              // Set scrolling bounds of the chart
              chartView.setMaximumViewport(maxViewport);
              // Set the initial chart bounds
              chartView.setCurrentViewport(initialViewport);
             /* LineChartData data = new LineChartData();
              float data1=data.getBaseValue();
              TextView tvName = (TextView)findViewById(R.id.textView);
              tvName.setText((int) data1);*/
  
          }
      });
      // Load chart data asynchronously
      tsChart.loadChartData();
      }
  
  }
  </code></pre>