Skip to content

Instantly share code, notes, and snippets.

@bryantee
Created November 22, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryantee/368340bae5b19a129e2e69a41bf2b534 to your computer and use it in GitHub Desktop.
Save bryantee/368340bae5b19a129e2e69a41bf2b534 to your computer and use it in GitHub Desktop.
determine spacing when you know width of items and total width of parent
const spaceBetweenDataPoints = (this.chartDimensions.width - data.length * DATA_POINT_SIZE) / (data.length + 1);
const leftMargin = spaceBetweenDataPoints * (index + 1) + (index > 0 ? (index) * DATA_POINT_SIZE : 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment