@pushwoosh/kit-charts 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,7 +90,12 @@ const LADDER = [{
90
90
  }];
91
91
  const pickRungIndex = (span, count) => {
92
92
  const target = span / Math.max(1, count);
93
- const found = LADDER.findIndex(rung => rung.approx >= target);
93
+ // Highcharts keeps a rung until the midpoint to the next one, so a month of data read at
94
+ // three days a tick still steps by two days instead of jumping to whole weeks.
95
+ const found = LADDER.findIndex((rung, index) => {
96
+ const next = LADDER[index + 1];
97
+ return !next || target <= (rung.approx + next.approx) / 2;
98
+ });
94
99
  return found === -1 ? LADDER.length - 1 : found;
95
100
  };
96
101
  const alignUp = (from, rung) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-charts",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Small React chart library on SVG, with a Highcharts-shaped configuration model",
5
5
  "license": "MIT",
6
6
  "repository": {