code: protected void onLegendDataChanged() {
  
          int   legendCount = mLegendList.size();
          float margin = (mGraphWidth / legendCount);
          float currentOffset = 0;
  
          for (LegendModel model : mLegendList) {
              model.setLegendBounds(new RectF(currentOffset, 0, currentOffset + margin, mLegendHeight));
              currentOffset += margin;
          }
  
          Utils.calculateLegendInformation(mLegendList, 0, mGraphWidth, mLegendPaint);
  
          invalidateGlobal();
      }
docs: Calculates the legend bounds for a custom list of legends.