@semcore/d3-chart 1.5.3 → 1.6.0

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/cjs/Area.js +15 -13
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +12 -12
  5. package/lib/cjs/Bar.js +11 -14
  6. package/lib/cjs/Bar.js.map +1 -1
  7. package/lib/cjs/Bubble.js +272 -0
  8. package/lib/cjs/Bubble.js.map +1 -0
  9. package/lib/cjs/Donut.js +77 -64
  10. package/lib/cjs/Donut.js.map +1 -1
  11. package/lib/cjs/Dots.js +8 -7
  12. package/lib/cjs/Dots.js.map +1 -1
  13. package/lib/cjs/GroupBar.js +8 -7
  14. package/lib/cjs/GroupBar.js.map +1 -1
  15. package/lib/cjs/HorizontalBar.js +11 -14
  16. package/lib/cjs/HorizontalBar.js.map +1 -1
  17. package/lib/cjs/Hover.js +3 -3
  18. package/lib/cjs/Line.js +14 -12
  19. package/lib/cjs/Line.js.map +1 -1
  20. package/lib/cjs/ScatterPlot.js +220 -0
  21. package/lib/cjs/ScatterPlot.js.map +1 -0
  22. package/lib/cjs/StackBar.js +39 -14
  23. package/lib/cjs/StackBar.js.map +1 -1
  24. package/lib/cjs/StackedArea.js +11 -9
  25. package/lib/cjs/StackedArea.js.map +1 -1
  26. package/lib/cjs/Tooltip.js +11 -11
  27. package/lib/cjs/Tooltip.js.map +1 -1
  28. package/lib/cjs/Venn.js +8 -8
  29. package/lib/cjs/Venn.js.map +1 -1
  30. package/lib/cjs/color.js +32 -30
  31. package/lib/cjs/color.js.map +1 -1
  32. package/lib/cjs/index.js +16 -0
  33. package/lib/cjs/index.js.map +1 -1
  34. package/lib/cjs/style/area.shadow.css +12 -2
  35. package/lib/cjs/style/bar.shadow.css +7 -2
  36. package/lib/cjs/style/bubble.shadow.css +45 -0
  37. package/lib/cjs/style/donut.shadow.css +15 -0
  38. package/lib/cjs/style/dot.shadow.css +6 -1
  39. package/lib/cjs/style/line.shadow.css +6 -1
  40. package/lib/cjs/style/scatterplot.shadow.css +27 -0
  41. package/lib/cjs/style/tooltip.shadow.css +7 -2
  42. package/lib/cjs/style/var.css +32 -0
  43. package/lib/cjs/style/venn.shadow.css +7 -1
  44. package/lib/es6/Area.js +15 -13
  45. package/lib/es6/Area.js.map +1 -1
  46. package/lib/es6/Axis.js +12 -12
  47. package/lib/es6/Bar.js +11 -14
  48. package/lib/es6/Bar.js.map +1 -1
  49. package/lib/es6/Bubble.js +255 -0
  50. package/lib/es6/Bubble.js.map +1 -0
  51. package/lib/es6/Donut.js +77 -64
  52. package/lib/es6/Donut.js.map +1 -1
  53. package/lib/es6/Dots.js +8 -7
  54. package/lib/es6/Dots.js.map +1 -1
  55. package/lib/es6/GroupBar.js +8 -7
  56. package/lib/es6/GroupBar.js.map +1 -1
  57. package/lib/es6/HorizontalBar.js +11 -14
  58. package/lib/es6/HorizontalBar.js.map +1 -1
  59. package/lib/es6/Hover.js +3 -3
  60. package/lib/es6/Line.js +14 -12
  61. package/lib/es6/Line.js.map +1 -1
  62. package/lib/es6/ScatterPlot.js +205 -0
  63. package/lib/es6/ScatterPlot.js.map +1 -0
  64. package/lib/es6/StackBar.js +39 -14
  65. package/lib/es6/StackBar.js.map +1 -1
  66. package/lib/es6/StackedArea.js +11 -9
  67. package/lib/es6/StackedArea.js.map +1 -1
  68. package/lib/es6/Tooltip.js +10 -10
  69. package/lib/es6/Tooltip.js.map +1 -1
  70. package/lib/es6/Venn.js +8 -8
  71. package/lib/es6/Venn.js.map +1 -1
  72. package/lib/es6/color.js +33 -31
  73. package/lib/es6/color.js.map +1 -1
  74. package/lib/es6/index.js +2 -0
  75. package/lib/es6/index.js.map +1 -1
  76. package/lib/es6/style/area.shadow.css +12 -2
  77. package/lib/es6/style/bar.shadow.css +7 -2
  78. package/lib/es6/style/bubble.shadow.css +45 -0
  79. package/lib/es6/style/donut.shadow.css +15 -0
  80. package/lib/es6/style/dot.shadow.css +6 -1
  81. package/lib/es6/style/line.shadow.css +6 -1
  82. package/lib/es6/style/scatterplot.shadow.css +27 -0
  83. package/lib/es6/style/tooltip.shadow.css +7 -2
  84. package/lib/es6/style/var.css +32 -0
  85. package/lib/es6/style/venn.shadow.css +7 -1
  86. package/lib/types/Bar.d.ts +1 -1
  87. package/lib/types/Bubble.d.ts +27 -0
  88. package/lib/types/HorizontalBar.d.ts +1 -1
  89. package/lib/types/ScatterPlot.d.ts +27 -0
  90. package/lib/types/index.d.ts +6 -0
  91. package/package.json +1 -1
  92. package/src/Area.js +2 -3
  93. package/src/Bar.js +6 -8
  94. package/src/Bubble.js +189 -0
  95. package/src/Donut.js +8 -7
  96. package/src/GroupBar.js +6 -2
  97. package/src/HorizontalBar.js +5 -8
  98. package/src/Line.js +2 -3
  99. package/src/ScatterPlot.js +130 -0
  100. package/src/StackBar.js +24 -7
  101. package/src/StackedArea.js +3 -2
  102. package/src/Tooltip.js +2 -2
  103. package/src/Venn.js +1 -1
  104. package/src/color.js +6 -32
  105. package/src/index.js +2 -0
  106. package/src/style/area.shadow.css +12 -2
  107. package/src/style/bar.shadow.css +7 -2
  108. package/src/style/bubble.shadow.css +45 -0
  109. package/src/style/donut.shadow.css +15 -0
  110. package/src/style/dot.shadow.css +6 -1
  111. package/src/style/line.shadow.css +6 -1
  112. package/src/style/scatterplot.shadow.css +27 -0
  113. package/src/style/tooltip.shadow.css +7 -2
  114. package/src/style/var.css +32 -0
  115. package/src/style/venn.shadow.css +7 -1
  116. package/src/types/Bar.d.ts +1 -1
  117. package/src/types/Bubble.d.ts +27 -0
  118. package/src/types/HorizontalBar.d.ts +1 -1
  119. package/src/types/ScatterPlot.d.ts +27 -0
  120. package/src/types/index.d.ts +6 -0
package/lib/es6/color.js CHANGED
@@ -1,40 +1,42 @@
1
- export var colors = {
2
- 'blue-01': '#50aef4',
3
- 'blue-02': '#91c7ef',
4
- 'blue-03': '#0e75c2',
5
- 'blue-04': '#d1e8f8',
6
- 'blue-05': '#084c80',
7
- 'green-01': '#3ab011',
8
- 'green-02': '#91d27b',
9
- 'green-03': '#278707',
10
- 'green-04': '#d1edc8',
11
- 'green-05': '#1a6700',
12
- 'orange-01': '#ff8e29',
13
- 'orange-02': '#fec089',
14
- 'orange-03': '#da6905',
15
- 'orange-04': '#ffe5cd',
16
- 'orange-05': '#a14e03',
17
- 'violet-01': '#890c85',
18
- 'violet-02': '#c783c5',
19
- 'violet-03': '#6e026b',
20
- 'violet-04': '#e7cbe6',
21
- 'violet-05': '#4d024b',
22
- 'red-01': '#e91e25',
23
- 'red-02': '#f69498',
24
- 'red-03': '#bd0000',
25
- 'red-04': '#fbd2d3',
26
- 'red-05': '#830005',
27
- 'yellow-01': '#ffc83f',
28
- 'yellow-02': '#ffdb82',
29
- 'yellow-03': '#e4aa18',
30
- 'yellow-04': '#ffebb9',
31
- 'yellow-05': '#b3840c'
1
+ /*__semcore-vars__:"./style/var.css"*/
2
+ var colors = {
3
+ "blue-01": "#50aef4",
4
+ "blue-02": "#91c7ef",
5
+ "blue-03": "#0e75c2",
6
+ "blue-04": "#d1e8f8",
7
+ "blue-05": "#084c80",
8
+ "green-01": "#3ab011",
9
+ "green-02": "#91d27b",
10
+ "green-03": "#278707",
11
+ "green-04": "#d1edc8",
12
+ "green-05": "#1a6700",
13
+ "orange-01": "#ff8e29",
14
+ "orange-02": "#fec089",
15
+ "orange-03": "#da6905",
16
+ "orange-04": "#ffe5cd",
17
+ "orange-05": "#a14e03",
18
+ "violet-01": "#890c85",
19
+ "violet-02": "#c783c5",
20
+ "violet-03": "#6e026b",
21
+ "violet-04": "#e7cbe6",
22
+ "violet-05": "#4d024b",
23
+ "red-01": "#e91e25",
24
+ "red-02": "#f69498",
25
+ "red-03": "#bd0000",
26
+ "red-04": "#fbd2d3",
27
+ "red-05": "#830005",
28
+ "yellow-01": "#ffc83f",
29
+ "yellow-02": "#ffdb82",
30
+ "yellow-03": "#e4aa18",
31
+ "yellow-04": "#ffebb9",
32
+ "yellow-05": "#b3840c"
32
33
  };
33
34
  var componentRenderIndex = 0;
34
35
  var cache = {};
35
36
  var colorValues = Object.keys(colors).sort(function (a, b) {
36
37
  return parseInt(a.match(/[0-9]/g).join(''), 10) - parseInt(b.match(/[0-9]/g).join(''), 10);
37
38
  });
39
+ export { colors };
38
40
  export default function getColor(key) {
39
41
  if (cache[key]) {
40
42
  return cache[key];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/color.js"],"names":["colors","componentRenderIndex","cache","colorValues","Object","keys","sort","a","b","parseInt","match","join","getColor","key","color"],"mappings":"AAAA,OAAO,IAAMA,MAAM,GAAG;AACpB,aAAW,SADS;AAEpB,aAAW,SAFS;AAGpB,aAAW,SAHS;AAIpB,aAAW,SAJS;AAKpB,aAAW,SALS;AAMpB,cAAY,SANQ;AAOpB,cAAY,SAPQ;AAQpB,cAAY,SARQ;AASpB,cAAY,SATQ;AAUpB,cAAY,SAVQ;AAWpB,eAAa,SAXO;AAYpB,eAAa,SAZO;AAapB,eAAa,SAbO;AAcpB,eAAa,SAdO;AAepB,eAAa,SAfO;AAgBpB,eAAa,SAhBO;AAiBpB,eAAa,SAjBO;AAkBpB,eAAa,SAlBO;AAmBpB,eAAa,SAnBO;AAoBpB,eAAa,SApBO;AAqBpB,YAAU,SArBU;AAsBpB,YAAU,SAtBU;AAuBpB,YAAU,SAvBU;AAwBpB,YAAU,SAxBU;AAyBpB,YAAU,SAzBU;AA0BpB,eAAa,SA1BO;AA2BpB,eAAa,SA3BO;AA4BpB,eAAa,SA5BO;AA6BpB,eAAa,SA7BO;AA8BpB,eAAa;AA9BO,CAAf;AAiCP,IAAIC,oBAAoB,GAAG,CAA3B;AACA,IAAMC,KAAK,GAAG,EAAd;AACA,IAAMC,WAAW,GAAGC,MAAM,CAACC,IAAP,CAAYL,MAAZ,EAAoBM,IAApB,CAAyB,UAACC,CAAD,EAAIC,CAAJ,EAAU;AACrD,SAAOC,QAAQ,CAACF,CAAC,CAACG,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAAR,GAA2CF,QAAQ,CAACD,CAAC,CAACE,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAA1D;AACD,CAFmB,CAApB;AAIA,eAAe,SAASC,QAAT,CAAkBC,GAAlB,EAAuB;AACpC,MAAIX,KAAK,CAACW,GAAD,CAAT,EAAgB;AACd,WAAOX,KAAK,CAACW,GAAD,CAAZ;AACD;;AACD,MAAMC,KAAK,GAAGd,MAAM,CAACG,WAAW,CAACF,oBAAoB,EAArB,CAAZ,CAApB;AACAC,EAAAA,KAAK,CAACW,GAAD,CAAL,GAAaC,KAAb;AACA,SAAOA,KAAP;AACD","sourcesContent":["export const colors = {\n 'blue-01': '#50aef4',\n 'blue-02': '#91c7ef',\n 'blue-03': '#0e75c2',\n 'blue-04': '#d1e8f8',\n 'blue-05': '#084c80',\n 'green-01': '#3ab011',\n 'green-02': '#91d27b',\n 'green-03': '#278707',\n 'green-04': '#d1edc8',\n 'green-05': '#1a6700',\n 'orange-01': '#ff8e29',\n 'orange-02': '#fec089',\n 'orange-03': '#da6905',\n 'orange-04': '#ffe5cd',\n 'orange-05': '#a14e03',\n 'violet-01': '#890c85',\n 'violet-02': '#c783c5',\n 'violet-03': '#6e026b',\n 'violet-04': '#e7cbe6',\n 'violet-05': '#4d024b',\n 'red-01': '#e91e25',\n 'red-02': '#f69498',\n 'red-03': '#bd0000',\n 'red-04': '#fbd2d3',\n 'red-05': '#830005',\n 'yellow-01': '#ffc83f',\n 'yellow-02': '#ffdb82',\n 'yellow-03': '#e4aa18',\n 'yellow-04': '#ffebb9',\n 'yellow-05': '#b3840c',\n};\n\nlet componentRenderIndex = 0;\nconst cache = {};\nconst colorValues = Object.keys(colors).sort((a, b) => {\n return parseInt(a.match(/[0-9]/g).join(''), 10) - parseInt(b.match(/[0-9]/g).join(''), 10);\n});\n\nexport default function getColor(key) {\n if (cache[key]) {\n return cache[key];\n }\n const color = colors[colorValues[componentRenderIndex++]];\n cache[key] = color;\n return color;\n}\n"],"file":"color.js"}
1
+ {"version":3,"sources":["../../src/color.js"],"names":["colors","componentRenderIndex","cache","colorValues","Object","keys","sort","a","b","parseInt","match","join","getColor","key","color"],"mappings":"AAAA;AACA,IAAMA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAZ;AAKA,IAAIC,oBAAoB,GAAG,CAA3B;AACA,IAAMC,KAAK,GAAG,EAAd;AACA,IAAMC,WAAW,GAAGC,MAAM,CAACC,IAAP,CAAYL,MAAZ,EAAoBM,IAApB,CAAyB,UAACC,CAAD,EAAIC,CAAJ,EAAU;AACrD,SAAOC,QAAQ,CAACF,CAAC,CAACG,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAAR,GAA2CF,QAAQ,CAACD,CAAC,CAACE,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAA1D;AACD,CAFmB,CAApB;AAIA,SAASX,MAAT;AACA,eAAe,SAASY,QAAT,CAAkBC,GAAlB,EAAuB;AACpC,MAAIX,KAAK,CAACW,GAAD,CAAT,EAAgB;AACd,WAAOX,KAAK,CAACW,GAAD,CAAZ;AACD;;AACD,MAAMC,KAAK,GAAGd,MAAM,CAACG,WAAW,CAACF,oBAAoB,EAArB,CAAZ,CAApB;AACAC,EAAAA,KAAK,CAACW,GAAD,CAAL,GAAaC,KAAb;AACA,SAAOA,KAAP;AACD","sourcesContent":["/*__semcore-vars__:\"./style/var.css\"*/\nconst colors = preval`\n const path = require('path');\n module.exports = require('@semcore/babel-plugin-react-semcore/utils/vars')(path.resolve(__dirname, './style/var.css'));\n`;\n\nlet componentRenderIndex = 0;\nconst cache = {};\nconst colorValues = Object.keys(colors).sort((a, b) => {\n return parseInt(a.match(/[0-9]/g).join(''), 10) - parseInt(b.match(/[0-9]/g).join(''), 10);\n});\n\nexport { colors };\nexport default function getColor(key) {\n if (cache[key]) {\n return cache[key];\n }\n const color = colors[colorValues[componentRenderIndex++]];\n cache[key] = color;\n return color;\n}\n"],"file":"color.js"}
package/lib/es6/index.js CHANGED
@@ -7,6 +7,8 @@ export { default as GroupBar } from './GroupBar';
7
7
  export { default as StackBar } from './StackBar';
8
8
  export { default as Area } from './Area';
9
9
  export { default as StackedArea } from './StackedArea';
10
+ export { default as ScatterPlot } from './ScatterPlot';
11
+ export { default as Bubble } from './Bubble';
10
12
  export { default as Donut } from './Donut';
11
13
  export { default as Venn } from './Venn';
12
14
  export { default as Tooltip } from './Tooltip';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.js"],"names":["default","Plot","XAxis","YAxis","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","Donut","Venn","Tooltip","ResponsiveContainer","HoverLine","HoverRect","minMax","colors"],"mappings":"AAAA,SAASA,OAAO,IAAIC,IAApB,QAAgC,QAAhC;AAEA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,QAA7B;AAEA,SAASH,OAAO,IAAII,IAApB,QAAgC,QAAhC;AAEA,SAASJ,OAAO,IAAIK,GAApB,QAA+B,OAA/B;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,QAApB,QAAoC,YAApC;AACA,SAASP,OAAO,IAAIQ,QAApB,QAAoC,YAApC;AACA,SAASR,OAAO,IAAIS,IAApB,QAAgC,QAAhC;AACA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,SAASV,OAAO,IAAIW,KAApB,QAAiC,SAAjC;AACA,SAASX,OAAO,IAAIY,IAApB,QAAgC,QAAhC;AAEA,SAASZ,OAAO,IAAIa,OAApB,QAAmC,WAAnC;AAEA,SAASb,OAAO,IAAIc,mBAApB,QAA+C,uBAA/C;AAEA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,SAArC;AAEA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,SAAvB","sourcesContent":["export { default as Plot } from './Plot';\n\nexport { XAxis, YAxis } from './Axis';\n\nexport { default as Line } from './Line';\n\nexport { default as Bar } from './Bar';\nexport { default as HorizontalBar } from './HorizontalBar';\nexport { default as GroupBar } from './GroupBar';\nexport { default as StackBar } from './StackBar';\nexport { default as Area } from './Area';\nexport { default as StackedArea } from './StackedArea';\nexport { default as Donut } from './Donut';\nexport { default as Venn } from './Venn';\n\nexport { default as Tooltip } from './Tooltip';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\n\nexport { HoverLine, HoverRect } from './Hover';\n\nexport { minMax } from './utils';\nexport { colors } from './color';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.js"],"names":["default","Plot","XAxis","YAxis","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","ScatterPlot","Bubble","Donut","Venn","Tooltip","ResponsiveContainer","HoverLine","HoverRect","minMax","colors"],"mappings":"AAAA,SAASA,OAAO,IAAIC,IAApB,QAAgC,QAAhC;AAEA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,QAA7B;AAEA,SAASH,OAAO,IAAII,IAApB,QAAgC,QAAhC;AAEA,SAASJ,OAAO,IAAIK,GAApB,QAA+B,OAA/B;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,QAApB,QAAoC,YAApC;AACA,SAASP,OAAO,IAAIQ,QAApB,QAAoC,YAApC;AACA,SAASR,OAAO,IAAIS,IAApB,QAAgC,QAAhC;AACA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,SAASV,OAAO,IAAIW,WAApB,QAAuC,eAAvC;AACA,SAASX,OAAO,IAAIY,MAApB,QAAkC,UAAlC;AACA,SAASZ,OAAO,IAAIa,KAApB,QAAiC,SAAjC;AACA,SAASb,OAAO,IAAIc,IAApB,QAAgC,QAAhC;AAEA,SAASd,OAAO,IAAIe,OAApB,QAAmC,WAAnC;AAEA,SAASf,OAAO,IAAIgB,mBAApB,QAA+C,uBAA/C;AAEA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,SAArC;AAEA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,SAAvB","sourcesContent":["export { default as Plot } from './Plot';\n\nexport { XAxis, YAxis } from './Axis';\n\nexport { default as Line } from './Line';\n\nexport { default as Bar } from './Bar';\nexport { default as HorizontalBar } from './HorizontalBar';\nexport { default as GroupBar } from './GroupBar';\nexport { default as StackBar } from './StackBar';\nexport { default as Area } from './Area';\nexport { default as StackedArea } from './StackedArea';\nexport { default as ScatterPlot } from './ScatterPlot';\nexport { default as Bubble } from './Bubble';\nexport { default as Donut } from './Donut';\nexport { default as Venn } from './Venn';\n\nexport { default as Tooltip } from './Tooltip';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\n\nexport { HoverLine, HoverRect } from './Hover';\n\nexport { minMax } from './utils';\nexport { colors } from './color';\n"],"file":"index.js"}
@@ -1,14 +1,24 @@
1
+ @import '@semcore/d3-chart/src/style/var.css';
2
+
1
3
  SArea {
2
- fill: var(--color);
4
+ fill: var(--blue-01);
3
5
  fill-opacity: 0.4;
4
6
  }
5
7
 
8
+ SArea[color] {
9
+ fill: var(--color);
10
+ }
11
+
6
12
  SAreaLine {
7
- stroke: var(--color);
13
+ stroke: var(--blue-01);
8
14
  stroke-width: 3;
9
15
  fill: transparent;
10
16
  }
11
17
 
18
+ SAreaLine[color] {
19
+ stroke: var(--color);
20
+ }
21
+
12
22
  SArea,
13
23
  SAreaLine {
14
24
  transition-property: d;
@@ -1,16 +1,21 @@
1
1
  @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
2
3
 
3
4
  SBar {
4
- fill: var(--color);
5
+ fill: var(--blue-01);
5
6
  transition-property: height, width, y;
6
7
  transition-duration: var(--duration);
7
8
  transition-timing-function: ease-in-out;
8
9
  }
9
10
 
11
+ SBar[color] {
12
+ fill: var(--color);
13
+ }
14
+
10
15
  SBar[hide] {
11
16
  display: none;
12
17
  }
13
18
 
14
19
  SBackground {
15
- fill: color-mod(var(--mystic));
20
+ fill: var(--mystic);
16
21
  }
@@ -0,0 +1,45 @@
1
+ @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
3
+
4
+ SBubble {
5
+ fill: #2bb3ff;
6
+ stroke: #fff;
7
+ stroke-width: 2px;
8
+ transition-property: cx, cy;
9
+ transition-duration: var(--duration);
10
+ transition-timing-function: ease-in-out;
11
+ opacity: 0.5;
12
+ &:hover {
13
+ opacity: 0.8;
14
+ }
15
+ }
16
+
17
+ SBubble[color] {
18
+ fill: var(--color);
19
+ }
20
+
21
+ SCenter {
22
+ text-anchor: middle;
23
+ font-size: 11px;
24
+ stroke: #2bb3ff;
25
+ }
26
+
27
+ SCenter[color] {
28
+ stroke: var(--color);
29
+ }
30
+
31
+ SLabel {
32
+ fill: #2bb3ff;
33
+ }
34
+
35
+ SLabel[position='right'] {
36
+ text-anchor: end;
37
+ }
38
+
39
+ SLabel[position='left'] {
40
+ text-anchor: start;
41
+ }
42
+
43
+ SLabel[color] {
44
+ fill: var(--color);
45
+ }
@@ -1,5 +1,20 @@
1
+ @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
3
+
1
4
  SPie {
2
5
  stroke: #ffffff;
6
+ fill: var(--blue-01);
7
+ }
8
+
9
+ SPie[color] {
10
+ fill: var(--color);
11
+ }
12
+
13
+ SEmptyData {
14
+ fill: var(--mystic);
15
+ }
16
+
17
+ SEmptyData[color] {
3
18
  fill: var(--color);
4
19
  }
5
20
 
@@ -1,15 +1,20 @@
1
1
  @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
2
3
 
3
4
  SDot {
4
5
  stroke-width: 2px;
5
6
  stroke: #fff;
6
7
  r: 6px;
7
- fill: var(--color);
8
+ fill: var(--blue-01);
8
9
  transition-property: cx, cy;
9
10
  transition-duration: var(--duration);
10
11
  transition-timing-function: ease-in-out;
11
12
  }
12
13
 
14
+ SDot[color] {
15
+ fill: var(--color);
16
+ }
17
+
13
18
  SDot[hide] {
14
19
  display: none;
15
20
  }
@@ -1,14 +1,19 @@
1
1
  @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
2
3
 
3
4
  SLine {
4
5
  fill: transparent;
5
6
  stroke-width: 3;
6
- stroke: var(--color);
7
+ stroke: var(--blue-01);
7
8
  transition-property: d;
8
9
  transition-duration: var(--duration);
9
10
  transition-timing-function: ease-in-out;
10
11
  }
11
12
 
13
+ SLine[color] {
14
+ stroke: var(--color);
15
+ }
16
+
12
17
  SLine[hide] {
13
18
  display: none;
14
19
  }
@@ -0,0 +1,27 @@
1
+ @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
3
+
4
+ SScatterPlot {
5
+ fill: #2bb3ff;
6
+ transition-property: cx, cy;
7
+ transition-duration: var(--duration);
8
+ transition-timing-function: ease-in-out;
9
+ opacity: 0.5;
10
+ &:hover {
11
+ opacity: 0.8;
12
+ }
13
+ }
14
+
15
+ SScatterPlot[color] {
16
+ fill: var(--color);
17
+ }
18
+
19
+ SValue {
20
+ text-anchor: middle;
21
+ font-size: 10px;
22
+ stroke: #008ff8;
23
+ }
24
+
25
+ SValue[color] {
26
+ stroke: var(--color);
27
+ }
@@ -1,6 +1,9 @@
1
1
  @import '@semcore/utils/style/var.css';
2
+ @import '@semcore/d3-chart/src/style/var.css';
2
3
 
3
4
  STooltip {
5
+ font-size: var(--fs-100);
6
+ line-height: var(--lh-100);
4
7
  position: relative;
5
8
  background-color: #fff;
6
9
  border-radius: 3px;
@@ -11,8 +14,6 @@ STooltip {
11
14
  }
12
15
 
13
16
  STitle {
14
- font-size: var(--fs-100);
15
- line-height: var(--lh-100);
16
17
  color: var(--gray60);
17
18
  margin-bottom: 8px;
18
19
  }
@@ -27,5 +28,9 @@ SDot {
27
28
  height: 8px;
28
29
  border-radius: 50%;
29
30
  margin-right: 8px;
31
+ background: var(--blue-01);
32
+ }
33
+
34
+ SDot[color] {
30
35
  background: var(--color);
31
36
  }
@@ -0,0 +1,32 @@
1
+ :root {
2
+ --blue-01: #50aef4;
3
+ --blue-02: #91c7ef;
4
+ --blue-03: #0e75c2;
5
+ --blue-04: #d1e8f8;
6
+ --blue-05: #084c80;
7
+ --green-01: #3ab011;
8
+ --green-02: #91d27b;
9
+ --green-03: #278707;
10
+ --green-04: #d1edc8;
11
+ --green-05: #1a6700;
12
+ --orange-01: #ff8e29;
13
+ --orange-02: #fec089;
14
+ --orange-03: #da6905;
15
+ --orange-04: #ffe5cd;
16
+ --orange-05: #a14e03;
17
+ --violet-01: #890c85;
18
+ --violet-02: #c783c5;
19
+ --violet-03: #6e026b;
20
+ --violet-04: #e7cbe6;
21
+ --violet-05: #4d024b;
22
+ --red-01: #e91e25;
23
+ --red-02: #f69498;
24
+ --red-03: #bd0000;
25
+ --red-04: #fbd2d3;
26
+ --red-05: #830005;
27
+ --yellow-01: #ffc83f;
28
+ --yellow-02: #ffdb82;
29
+ --yellow-03: #e4aa18;
30
+ --yellow-04: #ffebb9;
31
+ --yellow-05: #b3840c;
32
+ }
@@ -1,5 +1,7 @@
1
+ @import '@semcore/d3-chart/src/style/var.css';
2
+
1
3
  SCircle {
2
- fill: var(--color);
4
+ fill: var(--green-01);
3
5
  stroke: #fff;
4
6
  stroke-width: 2px;
5
7
  fill-opacity: 0.5;
@@ -12,6 +14,10 @@ SCircle {
12
14
  }
13
15
  }
14
16
 
17
+ SCircle[color] {
18
+ fill: var(--color);
19
+ }
20
+
15
21
  SIntersection {
16
22
  stroke: #fff;
17
23
  stroke-width: 2px;
@@ -18,7 +18,7 @@ export interface IBarProps extends IContext {
18
18
  /** Radius of curvature
19
19
  * @default 2
20
20
  */
21
- r?: number;
21
+ r?: number | number[];
22
22
  }
23
23
 
24
24
  export interface IBarContext {
@@ -0,0 +1,27 @@
1
+ import { CProps, ReturnEl } from '@semcore/core';
2
+ import IContext from './context';
3
+
4
+ export interface IBubbleProps extends IContext {
5
+ /** Field from data for XAxis */
6
+ x: string;
7
+ /** Field from data for YAxis */
8
+ y: string;
9
+ /** Field from data for circle radius */
10
+ value: string;
11
+ /** Field from data for circle label */
12
+ label?: string;
13
+ /** Circle color */
14
+ color?: string;
15
+ /** Cross in the center of the bubble
16
+ * @default true
17
+ */
18
+ markedCross?: boolean;
19
+ /** Animation duration in ms
20
+ * @default 500
21
+ */
22
+ duration?: number;
23
+ }
24
+
25
+ declare const Bubble: <T>(props: CProps<IBubbleProps & T>) => ReturnEl;
26
+
27
+ export default Bubble;
@@ -17,7 +17,7 @@ export interface IHorizontalBarProps extends IContext {
17
17
  /** Radius of curvature
18
18
  * @default 2
19
19
  */
20
- r?: number;
20
+ r?: number | number[];
21
21
  }
22
22
 
23
23
  declare const HorizontalBar: (<T>(
@@ -0,0 +1,27 @@
1
+ import { CProps, ReturnEl } from '@semcore/core';
2
+ import IContext from './context';
3
+
4
+ export interface IScatterPlotProps extends IContext {
5
+ /** Field from data for XAxis */
6
+ x: string;
7
+ /** Field from data for YAxis */
8
+ y: string;
9
+ /** Field from data for circle value */
10
+ value?: string;
11
+ /** Circle color */
12
+ color?: string;
13
+ /** Circle value color */
14
+ valueColor?: string;
15
+ /** Animation duration in ms
16
+ * @default 500
17
+ */
18
+ duration?: number;
19
+ /** Radius of circles
20
+ * @default 5.5 or 12 with value
21
+ */
22
+ r?: number;
23
+ }
24
+
25
+ declare const ScatterPlot: <T>(props: CProps<IScatterPlotProps & T>) => ReturnEl;
26
+
27
+ export default ScatterPlot;
@@ -39,3 +39,9 @@ export * from './Donut';
39
39
 
40
40
  export { default as Tooltip } from './Tooltip';
41
41
  export * from './Tooltip';
42
+
43
+ export { default as ScatterPlot } from './ScatterPlot';
44
+ export * from './ScatterPlot';
45
+
46
+ export { default as Bubble } from './Bubble';
47
+ export * from './Bubble';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/d3-chart",
3
3
  "description": "SEMRush D3 Chart Component",
4
- "version": "1.5.3",
4
+ "version": "1.6.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
package/src/Area.js CHANGED
@@ -14,8 +14,8 @@ class AreaRoot extends Component {
14
14
  static style = style;
15
15
  static enhance = [uniqueIDEnhancement()];
16
16
 
17
- static defaultProps = ({ x, y, y0, $rootProps, curve = curveLinear }) => {
18
- const [xScale, yScale] = $rootProps.scale;
17
+ static defaultProps = ({ x, y, y0, $rootProps, curve = curveLinear, scale }) => {
18
+ const [xScale, yScale] = scale || $rootProps.scale;
19
19
  const yRange = yScale.range();
20
20
 
21
21
  return {
@@ -30,7 +30,6 @@ class AreaRoot extends Component {
30
30
  .curve(curve)
31
31
  .x((p) => scaleOfBandwidth(xScale, p[x]))
32
32
  .y((p) => scaleOfBandwidth(yScale, p[y])),
33
- color: '#50aef4',
34
33
  duration: 500,
35
34
  };
36
35
  };
package/src/Bar.js CHANGED
@@ -14,7 +14,6 @@ class BarRoot extends Component {
14
14
  static enhance = [uniqueIDEnhancement()];
15
15
 
16
16
  static defaultProps = {
17
- color: '#50aef4',
18
17
  offset: [0, 0],
19
18
  duration: 500,
20
19
  r: 2,
@@ -70,17 +69,16 @@ class BarRoot extends Component {
70
69
  const [xScale, yScale] = scale;
71
70
  const barY = yScale(Math.max(d[y0] ?? 0, d[y])) + offset[1];
72
71
  const barX = xScale(d[x]) + offset[0];
73
- let height = Math.abs(yScale(d[y]) - Math.min(yScale(yScale.domain()[0]), yScale(d[y0] ?? 0)));
74
- height = isRounded ? height + r : height;
72
+ const height = Math.abs(
73
+ yScale(d[y]) - Math.min(yScale(yScale.domain()[0]), yScale(d[y0] ?? 0)),
74
+ );
75
75
  const width = widthProps || getBandwidth(xScale);
76
- const isRounded = r !== 0;
77
- const yValue = isRounded ? (d[y] > 0 ? barY - r : barY) : barY;
78
76
  const dSvg = getRect({
79
77
  x: barX,
80
- y: yValue,
78
+ y: barY,
81
79
  width,
82
80
  height,
83
- radius: r,
81
+ radius: Array.isArray(r) ? r[i] : r,
84
82
  position: d[y] > 0 ? 'top' : 'bottom',
85
83
  });
86
84
 
@@ -96,7 +94,7 @@ class BarRoot extends Component {
96
94
  hide={hide}
97
95
  color={color}
98
96
  x={barX}
99
- y={yValue}
97
+ y={barY}
100
98
  width={width}
101
99
  height={height}
102
100
  d={dSvg}