title: How to convert String to Bar entry for MPCharts in android
body: <p>In my android application, I am new to graphs and using <strong>MPchart library</strong> to draw the graphs. I'm displaying the graph using string array on both - X axis and Y axis. </p>
  
  <p>For x axis I created it successfully but for Y axis I need to convert my <code>ArrayList&lt;String&gt;</code> to <code>BarData</code> array list. I don't know how to do convert it. Can anyone tell me how to achieve this?</p>
  
  <p><strong>For X axis:</strong></p>
  
  <pre><code>private ArrayList&lt;String&gt; getXAxis() {
              ArrayList&lt;String&gt; xAxis = new ArrayList&lt;&gt;();
              xAxis = new ArrayList&lt;String&gt;(Arrays.asList(bar_graph_names)); //converting string to arraylist
              return xAxis;
          }
  </code></pre>
  
  <p><strong>For Y axis plotting values:</strong></p>
  
  <pre><code>private ArrayList&lt;BarDataSet&gt; getData() {
          ArrayList&lt;String&gt; yAxis_conv = new ArrayList&lt;&gt;();
          yAxis_conv = new ArrayList&lt;String&gt;(Arrays.asList(bar_graph_values));
  
          ArrayList&lt;BarDataSet&gt; yAxis_Datasets=null;
          ArrayList&lt;BarEntry&gt; yAxis = new ArrayList&lt;&gt;();
  
          for(int i = 0; i &lt; bar_graph_values.length; i++)
          {
              BarEntry [] barentry = new BarEntry[bar_graph_values.length];
              barentry[i] = new BarEntry(Float.valueOf(yAxis_conv.get(i)),i);
          }           
  
          BarDataSet barDataSet1 = new BarDataSet(yAxis_conv , "");//Error occurring line
          barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS);
          yAxis_Datasets = new ArrayList&lt;&gt;();
          yAxis_Datasets.add(barDataSet1);
          return yAxis_Datasets;
      }
  </code></pre>