title: Center Chart LineData After Hide Values MPAndroidChart
body: <p>I have an <code>ArrayList&lt;ILineDataSet&gt;</code> that hide/show programatically on button click.</p>
  
  <p>How can i have the remained values centered on chart?</p>
  
  <pre><code>private void toggleDataSetVisibility(String label) {
      chart.invalidate();
      for (int i = 0; i &lt; allDataSets.size(); i++) {
          if (label != null) {
              if (label.equals(allDataSets.get(i).getLabel())) {
                  if (allDataSets.get(i).isVisible()) {
                      allDataSets.get(i).setVisible(false);
                      allDataSets.get(i).setDrawValues(false);
                  } else {
                      allDataSets.get(i).setVisible(true);
                      allDataSets.get(i).setDrawValues(true);
                  }
              }
          }
      }
      chart.getData().notifyDataChanged();
      chart.notifyDataSetChanged();
      chart.animateX(1500);
  }
  </code></pre>
  
  <p>EDIT:
  The chart renders with all data</p>
  
  <p><a href="https://i.stack.imgur.com/4yFsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4yFsg.png" alt="All line datas"></a></p>
  
  <p>After click </p>
  
  <pre><code>btnT1.setOnClickListener((v) -&gt; {
          toogleBtnPressed(v);
          toggleDataSetVisibility("T1");
      });
  
  
  
  if (v.getId() == btnT1.getId()) {
          if (btnT1.isSelected()) {
              btnT1.setSelected(false);
          } else {
              btnT1.setSelected(true);
          }
      }
  </code></pre>
  
  <p>and after hide de linedata values:</p>
  
  <p><a href="https://i.stack.imgur.com/4n1UD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4n1UD.png" alt="line data remain"></a></p>
  
  <p>on this point i want to refresh te zoom and center vertically the line data that remains</p>