@d3plus/docs 3.0.0-alpha.3

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 (225) hide show
  1. package/.storybook/main.js +51 -0
  2. package/.storybook/manager-head.html +46 -0
  3. package/.storybook/manager.js +10 -0
  4. package/.storybook/preview-head.html +69 -0
  5. package/.storybook/preview.jsx +134 -0
  6. package/.storybook/theme.js +16 -0
  7. package/README.md +1 -0
  8. package/args/color/colorAdd.args.jsx +71 -0
  9. package/args/color/colorAssign.args.jsx +40 -0
  10. package/args/color/colorContrast.args.jsx +40 -0
  11. package/args/color/colorDefaults.args.jsx +8 -0
  12. package/args/color/colorLegible.args.jsx +24 -0
  13. package/args/color/colorLighter.args.jsx +40 -0
  14. package/args/color/colorSubtract.args.jsx +71 -0
  15. package/args/core/charts/AreaPlot.args.jsx +72 -0
  16. package/args/core/charts/BarChart.args.jsx +88 -0
  17. package/args/core/charts/BoxWhisker.args.jsx +73 -0
  18. package/args/core/charts/BumpChart.args.jsx +133 -0
  19. package/args/core/charts/Donut.args.jsx +58 -0
  20. package/args/core/charts/Geomap.args.jsx +363 -0
  21. package/args/core/charts/LinePlot.args.jsx +57 -0
  22. package/args/core/charts/Matrix.args.jsx +194 -0
  23. package/args/core/charts/Network.args.jsx +310 -0
  24. package/args/core/charts/Pack.args.jsx +171 -0
  25. package/args/core/charts/Pie.args.jsx +148 -0
  26. package/args/core/charts/Plot.args.jsx +685 -0
  27. package/args/core/charts/Priestley.args.jsx +118 -0
  28. package/args/core/charts/Radar.args.jsx +120 -0
  29. package/args/core/charts/RadialMatrix.args.jsx +197 -0
  30. package/args/core/charts/Rings.args.jsx +228 -0
  31. package/args/core/charts/Sankey.args.jsx +248 -0
  32. package/args/core/charts/StackedArea.args.jsx +26 -0
  33. package/args/core/charts/Tree.args.jsx +88 -0
  34. package/args/core/charts/Treemap.args.jsx +181 -0
  35. package/args/core/charts/Viz.args.jsx +1383 -0
  36. package/args/core/components/Axis.args.jsx +600 -0
  37. package/args/core/components/AxisBottom.args.jsx +42 -0
  38. package/args/core/components/AxisLeft.args.jsx +42 -0
  39. package/args/core/components/AxisRight.args.jsx +42 -0
  40. package/args/core/components/AxisTop.args.jsx +42 -0
  41. package/args/core/components/ColorScale.args.jsx +456 -0
  42. package/args/core/components/Legend.args.jsx +289 -0
  43. package/args/core/components/TextBox.args.jsx +554 -0
  44. package/args/core/components/Timeline.args.jsx +401 -0
  45. package/args/core/components/Tooltip.args.jsx +453 -0
  46. package/args/core/shapes/Area.args.jsx +190 -0
  47. package/args/core/shapes/Bar.args.jsx +176 -0
  48. package/args/core/shapes/Box.args.jsx +248 -0
  49. package/args/core/shapes/Circle.args.jsx +84 -0
  50. package/args/core/shapes/Image.args.jsx +177 -0
  51. package/args/core/shapes/Line.args.jsx +127 -0
  52. package/args/core/shapes/Path.args.jsx +84 -0
  53. package/args/core/shapes/Rect.args.jsx +85 -0
  54. package/args/core/shapes/Shape.args.jsx +633 -0
  55. package/args/core/shapes/Whisker.args.jsx +204 -0
  56. package/args/core/utils/BaseClass.args.jsx +65 -0
  57. package/args/core/utils/RESET.args.jsx +8 -0
  58. package/args/core/utils/accessor.args.jsx +39 -0
  59. package/args/core/utils/configPrep.args.jsx +56 -0
  60. package/args/core/utils/constant.args.jsx +24 -0
  61. package/args/core/utils/uuid.args.jsx +8 -0
  62. package/args/data/dataConcat.args.jsx +40 -0
  63. package/args/data/dataFold.args.jsx +56 -0
  64. package/args/data/dataLoad.args.jsx +65 -0
  65. package/args/data/isData.args.jsx +24 -0
  66. package/args/data/merge.args.jsx +39 -0
  67. package/args/data/unique.args.jsx +37 -0
  68. package/args/dom/assign.args.jsx +23 -0
  69. package/args/dom/attrize.args.jsx +39 -0
  70. package/args/dom/date.args.jsx +23 -0
  71. package/args/dom/elem.args.jsx +135 -0
  72. package/args/dom/fontExists.args.jsx +24 -0
  73. package/args/dom/htmlDecode.args.jsx +23 -0
  74. package/args/dom/isObject.args.jsx +23 -0
  75. package/args/dom/parseSides.args.jsx +24 -0
  76. package/args/dom/prefix.args.jsx +8 -0
  77. package/args/dom/rtl.args.jsx +8 -0
  78. package/args/dom/stylize.args.jsx +39 -0
  79. package/args/dom/textWidth.args.jsx +39 -0
  80. package/args/export/saveElement.args.jsx +99 -0
  81. package/args/format/format.args.jsx +24 -0
  82. package/args/format/formatAbbreviate.args.jsx +39 -0
  83. package/args/format/formatDate.args.jsx +53 -0
  84. package/args/format/formatDefaultLocale.args.jsx +24 -0
  85. package/args/locales/dictionaries/formatLocale.args.jsx +8 -0
  86. package/args/math/closest.args.jsx +39 -0
  87. package/args/math/largestRect.args.jsx +56 -0
  88. package/args/math/lineIntersection.args.jsx +69 -0
  89. package/args/math/path2polygon.args.jsx +40 -0
  90. package/args/math/pointDistance.args.jsx +39 -0
  91. package/args/math/pointDistanceSquared.args.jsx +39 -0
  92. package/args/math/pointRotate.args.jsx +55 -0
  93. package/args/math/polygonInside.args.jsx +39 -0
  94. package/args/math/polygonRayCast.args.jsx +55 -0
  95. package/args/math/polygonRotate.args.jsx +55 -0
  96. package/args/math/segmentBoxContains.args.jsx +54 -0
  97. package/args/math/segmentsIntersect.args.jsx +69 -0
  98. package/args/math/shapeEdgePoint.args.jsx +39 -0
  99. package/args/react/D3plusContext.args.jsx +8 -0
  100. package/args/react/Renderer.args.jsx +53 -0
  101. package/args/text/fontFamily.args.jsx +8 -0
  102. package/args/text/fontFamilyStringify.args.jsx +23 -0
  103. package/args/text/stringify.args.jsx +23 -0
  104. package/args/text/strip.args.jsx +38 -0
  105. package/args/text/textSplit.args.jsx +23 -0
  106. package/args/text/textWrap.args.jsx +8 -0
  107. package/args/text/titleCase.args.jsx +24 -0
  108. package/args/text/trim.args.jsx +23 -0
  109. package/args/text/trimLeft.args.jsx +23 -0
  110. package/args/text/trimRight.args.jsx +23 -0
  111. package/docs/Accessibility.mdx +70 -0
  112. package/docs/HomeChart.jsx +38 -0
  113. package/docs/Introduction.mdx +130 -0
  114. package/docs/Logo-Frames.js +352 -0
  115. package/docs/Logo.jsx +30 -0
  116. package/helpers/configify.js +18 -0
  117. package/helpers/funcify.js +14 -0
  118. package/helpers/stringify.js +30 -0
  119. package/package.json +44 -0
  120. package/packages/color/colorAdd.stories.jsx +23 -0
  121. package/packages/color/colorAssign.stories.jsx +23 -0
  122. package/packages/color/colorContrast.stories.jsx +23 -0
  123. package/packages/color/colorDefaults.stories.jsx +23 -0
  124. package/packages/color/colorLegible.stories.jsx +23 -0
  125. package/packages/color/colorLighter.stories.jsx +23 -0
  126. package/packages/color/colorSubtract.stories.jsx +23 -0
  127. package/packages/core/charts/AreaPlot.stories.jsx +74 -0
  128. package/packages/core/charts/BarChart.stories.jsx +307 -0
  129. package/packages/core/charts/BoxWhisker.stories.jsx +204 -0
  130. package/packages/core/charts/BumpChart.stories.jsx +52 -0
  131. package/packages/core/charts/Donut.stories.jsx +41 -0
  132. package/packages/core/charts/Geomap.stories.jsx +186 -0
  133. package/packages/core/charts/LinePlot.stories.jsx +564 -0
  134. package/packages/core/charts/Matrix.stories.jsx +36 -0
  135. package/packages/core/charts/Network.stories.jsx +99 -0
  136. package/packages/core/charts/Pack.stories.jsx +40 -0
  137. package/packages/core/charts/Pie.stories.jsx +40 -0
  138. package/packages/core/charts/Plot.stories.jsx +180 -0
  139. package/packages/core/charts/Priestley.stories.jsx +60 -0
  140. package/packages/core/charts/Radar.stories.jsx +60 -0
  141. package/packages/core/charts/RadialMatrix.stories.jsx +36 -0
  142. package/packages/core/charts/Rings.stories.jsx +41 -0
  143. package/packages/core/charts/Sankey.stories.jsx +41 -0
  144. package/packages/core/charts/StackedArea.stories.jsx +107 -0
  145. package/packages/core/charts/Tree.stories.jsx +27 -0
  146. package/packages/core/charts/Treemap.stories.jsx +81 -0
  147. package/packages/core/charts/Viz.stories.jsx +27 -0
  148. package/packages/core/components/Axis.stories.jsx +27 -0
  149. package/packages/core/components/AxisBottom.stories.jsx +27 -0
  150. package/packages/core/components/AxisLeft.stories.jsx +27 -0
  151. package/packages/core/components/AxisRight.stories.jsx +27 -0
  152. package/packages/core/components/AxisTop.stories.jsx +27 -0
  153. package/packages/core/components/ColorScale.stories.jsx +44 -0
  154. package/packages/core/components/Legend.stories.jsx +49 -0
  155. package/packages/core/components/TextBox.stories.jsx +222 -0
  156. package/packages/core/components/Timeline.stories.jsx +37 -0
  157. package/packages/core/components/Tooltip.stories.jsx +40 -0
  158. package/packages/core/shapes/Area.stories.jsx +27 -0
  159. package/packages/core/shapes/Bar.stories.jsx +27 -0
  160. package/packages/core/shapes/Box.stories.jsx +27 -0
  161. package/packages/core/shapes/Circle.stories.jsx +27 -0
  162. package/packages/core/shapes/Image.stories.jsx +27 -0
  163. package/packages/core/shapes/Line.stories.jsx +27 -0
  164. package/packages/core/shapes/Path.stories.jsx +27 -0
  165. package/packages/core/shapes/Rect.stories.jsx +27 -0
  166. package/packages/core/shapes/Shape.stories.jsx +27 -0
  167. package/packages/core/shapes/Whisker.stories.jsx +27 -0
  168. package/packages/core/utils/BaseClass.stories.jsx +27 -0
  169. package/packages/core/utils/RESET.stories.jsx +23 -0
  170. package/packages/core/utils/accessor.stories.jsx +23 -0
  171. package/packages/core/utils/configPrep.stories.jsx +23 -0
  172. package/packages/core/utils/constant.stories.jsx +23 -0
  173. package/packages/core/utils/uuid.stories.jsx +23 -0
  174. package/packages/data/dataConcat.stories.jsx +23 -0
  175. package/packages/data/dataFold.stories.jsx +23 -0
  176. package/packages/data/dataLoad.stories.jsx +23 -0
  177. package/packages/data/isData.stories.jsx +23 -0
  178. package/packages/data/merge.stories.jsx +23 -0
  179. package/packages/data/unique.stories.jsx +23 -0
  180. package/packages/dom/assign.stories.jsx +23 -0
  181. package/packages/dom/attrize.stories.jsx +23 -0
  182. package/packages/dom/date.stories.jsx +23 -0
  183. package/packages/dom/elem.stories.jsx +23 -0
  184. package/packages/dom/fontExists.stories.jsx +23 -0
  185. package/packages/dom/htmlDecode.stories.jsx +23 -0
  186. package/packages/dom/isObject.stories.jsx +23 -0
  187. package/packages/dom/parseSides.stories.jsx +23 -0
  188. package/packages/dom/prefix.stories.jsx +23 -0
  189. package/packages/dom/rtl.stories.jsx +23 -0
  190. package/packages/dom/stylize.stories.jsx +23 -0
  191. package/packages/dom/textWidth.stories.jsx +23 -0
  192. package/packages/export/saveElement.stories.jsx +23 -0
  193. package/packages/format/format.stories.jsx +23 -0
  194. package/packages/format/formatAbbreviate.stories.jsx +23 -0
  195. package/packages/format/formatDate.stories.jsx +23 -0
  196. package/packages/format/formatDefaultLocale.stories.jsx +23 -0
  197. package/packages/locales/dictionaries/formatLocale.stories.jsx +23 -0
  198. package/packages/math/closest.stories.jsx +23 -0
  199. package/packages/math/largestRect.stories.jsx +23 -0
  200. package/packages/math/lineIntersection.stories.jsx +23 -0
  201. package/packages/math/path2polygon.stories.jsx +23 -0
  202. package/packages/math/pointDistance.stories.jsx +23 -0
  203. package/packages/math/pointDistanceSquared.stories.jsx +23 -0
  204. package/packages/math/pointRotate.stories.jsx +23 -0
  205. package/packages/math/polygonInside.stories.jsx +23 -0
  206. package/packages/math/polygonRayCast.stories.jsx +23 -0
  207. package/packages/math/polygonRotate.stories.jsx +23 -0
  208. package/packages/math/segmentBoxContains.stories.jsx +23 -0
  209. package/packages/math/segmentsIntersect.stories.jsx +23 -0
  210. package/packages/math/shapeEdgePoint.stories.jsx +23 -0
  211. package/packages/react/D3plusContext.stories.jsx +23 -0
  212. package/packages/react/Renderer.stories.jsx +23 -0
  213. package/packages/text/fontFamily.stories.jsx +23 -0
  214. package/packages/text/fontFamilyStringify.stories.jsx +23 -0
  215. package/packages/text/stringify.stories.jsx +23 -0
  216. package/packages/text/strip.stories.jsx +23 -0
  217. package/packages/text/textSplit.stories.jsx +23 -0
  218. package/packages/text/textWrap.stories.jsx +23 -0
  219. package/packages/text/titleCase.stories.jsx +23 -0
  220. package/packages/text/trim.stories.jsx +23 -0
  221. package/packages/text/trimLeft.stories.jsx +23 -0
  222. package/packages/text/trimRight.stories.jsx +23 -0
  223. package/static/data/city_coords.json +224 -0
  224. package/static/images/favicon.ico +0 -0
  225. package/static/images/touchicon.png +0 -0
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ family: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string | array.<string>"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ value: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,38 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ spacer: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ defaultValue: "\"-\"",
14
+ table: {
15
+ defaultValue: {
16
+ summary: "\"-\""
17
+ }
18
+ },
19
+ type: {
20
+ required: false,
21
+ summary: "string"
22
+ }
23
+ },
24
+ value: {
25
+ control: {
26
+ type: "text"
27
+ },
28
+ table: {
29
+ defaultValue: {
30
+ summary: "undefined"
31
+ }
32
+ },
33
+ type: {
34
+ required: true,
35
+ summary: "string"
36
+ }
37
+ }
38
+ };
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ sentence: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,8 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {};
@@ -0,0 +1,24 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ str: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ description: "The string to apply the title case logic.",
14
+ table: {
15
+ defaultValue: {
16
+ summary: "undefined"
17
+ }
18
+ },
19
+ type: {
20
+ required: true,
21
+ summary: "string"
22
+ }
23
+ }
24
+ };
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ str: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ str: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,23 @@
1
+ // WARNING: do not edit this file directly, it is generated dynamically from
2
+ // the source JSDOC comments using the npm run docs script.
3
+
4
+ import React from "react";
5
+
6
+
7
+
8
+ export const argTypes = {
9
+ str: {
10
+ control: {
11
+ type: "text"
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: "undefined"
16
+ }
17
+ },
18
+ type: {
19
+ required: true,
20
+ summary: "string"
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,70 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ <Meta title="Accessibility" />
4
+
5
+ # Accessibility
6
+
7
+ D3plus is a collection of tools built on top of the low-level helper functions made available by D3 to help aid in the generation of charts. While D3 itself can be considered accessible out of the box, as it doesn't actively add any elements to a webpage (see [this discussion](https://github.com/d3/d3-shape/issues/102)), D3plus tries its best to make sure that the SVG elements that get added to the page include accessibility features automatically. This page outlines those features.
8
+
9
+ ## SVG "role" Attribute
10
+
11
+ All SVG elements created by D3plus contain a role attribute with the value "img". This ensures that all visualizations are identified as a graphic.
12
+
13
+ ```html
14
+ <svg role="img"> ... </svg>
15
+ ```
16
+
17
+ ## Shape "role" and "aria-label" Attributes
18
+
19
+ All shape DOM elements created by D3plus contain a `role` attribute with the value "presentation". They also contain an `aria-label` which describes the data related to the shape. At it's minimum, the value will contain the text label of the data point, but additional information (such as rank and/or value) is provided depending on the visualization.
20
+
21
+ ```html
22
+ <rect
23
+ aria-label="2. United States, 34%."
24
+ role="presentation"
25
+ width="300"
26
+ height="371"
27
+ x="-150"
28
+ y="-185.5"
29
+ fill="#b22200" />
30
+ ```
31
+
32
+ ## SVG "title" and "desc" (Optional)
33
+
34
+ The `svgTitle` and `svgDesc` methods can be set to include additional information about a chart for screen assistive technologies.
35
+
36
+ ```html
37
+ <svg aria-labelledby="title desc" aria-hidden="false">
38
+
39
+ <title id="title">
40
+ Bar Chart of Income Over Time
41
+ </title>
42
+
43
+ <desc id="desc">
44
+ The income in Texas has been rising steadily over the past 10 years.
45
+ </desc>
46
+
47
+ ...
48
+
49
+ </svg>
50
+ ```
51
+
52
+ ## Inline Data Table (Optional)
53
+
54
+ If `ariaHidden` is set to `"false"`, a visually hidden data table will be rendered inside of the SVG. This makes the data readable by screen assistive technologies, but may overload the DOM in larger websites.
55
+
56
+ ```html
57
+ <g role="table">
58
+ <text role="row">
59
+ <tspan role="columnheader" dy="-1000px">Year</tspan>
60
+ <tspan role="columnheader" dy="-1000px">State</tspan>
61
+ <tspan role="columnheader" dy="-1000px">Income</tspan>
62
+ </text>
63
+ <text role="row">
64
+ <tspan role="cell" dy="-1000px">2010</tspan>
65
+ <tspan role="cell" dy="-1000px">Texas</tspan>
66
+ <tspan role="cell" dy="-1000px">43218</tspan>
67
+ </text>
68
+ ...
69
+ </g>
70
+ ```
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import {Treemap} from "@d3plus/react";
3
+ import {Source} from '@storybook/blocks';
4
+ import stringify from "../helpers/stringify";
5
+
6
+ const Logo = () => {
7
+
8
+ const config = {
9
+ data: [
10
+ {id: "alpha", value: 29},
11
+ {id: "beta", value: 10},
12
+ {id: "gamma", value: 2},
13
+ {id: "delta", value: 29},
14
+ {id: "eta", value: 25}
15
+ ],
16
+ groupBy: "id",
17
+ sum: "value"
18
+ };
19
+
20
+ const code = `<Treemap config={${stringify(config)}} />`;
21
+
22
+ return (
23
+ <div style={{
24
+ alignItems: "stretch",
25
+ display: "flex",
26
+ height: "300px"
27
+ }}>
28
+ <div style={{marginRight: "20px", width: "300px"}}>
29
+ <Source code={code} />
30
+ </div>
31
+ <div style={{flex: "1 1 auto"}}>
32
+ <Treemap config={config} />
33
+ </div>
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export default Logo;
@@ -0,0 +1,130 @@
1
+ import {Meta} from '@storybook/blocks';
2
+ import Logo from "./Logo.jsx";
3
+ import HomeChart from "./HomeChart.jsx";
4
+
5
+ <Meta title="Introduction" />
6
+
7
+ <div style={{
8
+ display: "flex",
9
+ justifyContent: "center",
10
+ width: "100%"
11
+ }}>
12
+ <Logo />
13
+ </div>
14
+
15
+ D3plus is an open-source visualization library, written in JavaScript, that streamlines the creation of SVG data visualizations. After providing a configuration object that details the specifics of the data at hand, D3plus will create a visualization that includes all of the repeatable, generic things out of the box, such as setting up tooltips, color assignments, and label placements.
16
+
17
+ <HomeChart />
18
+
19
+ ## React Components
20
+
21
+ While the underlying library is written in JavaScript, we supply a wrapper package for rendering charts and components in a React environment:
22
+
23
+ ```sh
24
+ npm install @d3plus/react
25
+ ```
26
+
27
+ An _Object_ containing configuration information about the data and visual representation at hand then needs to be passed to the `config` prop of every visualization. The options available in this configuration _Object_ vary by visualization type, and the most commonly used methods are shown in the examples on this site. Full documentation of all available methods is available in each packages README file.
28
+
29
+ ```jsx
30
+ import {Treemap} from "@d3plus/react";
31
+
32
+ const methods = {
33
+ data: [
34
+ {id: "alpha", value: 29},
35
+ {id: "beta", value: 10}
36
+ ],
37
+ groupBy: "id",
38
+ size: "value"
39
+ };
40
+
41
+ <Treemap config={methods} />
42
+ ```
43
+
44
+ Additionally, a global set of styles can be set using the `D3plusContext` Provider. This allows you to set base styles on all of your visualizations in one place, often in an external file. A component's `config` set by props will override global defaults key-by-key using a deep cloning function.
45
+
46
+ ```jsx
47
+ import React from "react";
48
+ import ReactDOM from "react-dom/client";
49
+ import {D3plusContext} from "@d3plus/react";
50
+ import App from "src/App.jsx";
51
+
52
+ const globalConfig = {
53
+ title: "Shared Title for All Visualizations"
54
+ };
55
+
56
+ ReactDOM.createRoot(document.getElementById("viz")).render(
57
+ <React.StrictMode>
58
+ <D3plusContext.Provider value={globalConfig}>
59
+ <App />
60
+ </D3plusContext.Provider>
61
+ </React.StrictMode>
62
+ );
63
+ ```
64
+
65
+ ## ES Modules
66
+
67
+ Under the hood, D3plus is broken out into multiple packages based on the functionality offered by the exported code. These packages include:
68
+
69
+ * [@d3plus/react](https://www.npmjs.com/package/@d3plus/react)
70
+ * [@d3plus/core](https://www.npmjs.com/package/@d3plus/core)
71
+ * [@d3plus/color](https://www.npmjs.com/package/@d3plus/color)
72
+ * [@d3plus/data](https://www.npmjs.com/package/@d3plus/data)
73
+ * [@d3plus/dom](https://www.npmjs.com/package/@d3plus/dom)
74
+ * [@d3plus/export](https://www.npmjs.com/package/@d3plus/export)
75
+ * [@d3plus/format](https://www.npmjs.com/package/@d3plus/format)
76
+ * [@d3plus/locales](https://www.npmjs.com/package/@d3plus/locales)
77
+ * [@d3plus/math](https://www.npmjs.com/package/@d3plus/math)
78
+ * [@d3plus/text](https://www.npmjs.com/package/@d3plus/text)
79
+
80
+ For example, if you are interested in using the `formatAbbreviate` function used internally for prettifying numbers:
81
+
82
+ ```sh
83
+ npm install @d3plus/format
84
+ ```
85
+
86
+ You can then import named functions and classes as ES modules:
87
+
88
+ ```js
89
+ import {formatAbbreviate} from "@d3plus/format";
90
+ ```
91
+
92
+ ## Script Tags
93
+
94
+ Additionally, each module is available from a CDN for vanilla JavaScript environments (bundled with all dependencies):
95
+
96
+ ```html
97
+ <script src="https://cdn.jsdelivr.net/npm/d3plus-core@3"></script>
98
+ ```
99
+
100
+ A global `d3plus` object is exported, which contains all of the available methods and classes:
101
+
102
+ ```html
103
+ <script>
104
+ new d3plus.Treemap()
105
+ .config({
106
+ data: [
107
+ {id: "alpha", value: 29},
108
+ {id: "beta", value: 10}
109
+ ],
110
+ groupBy: "id",
111
+ size: "value"
112
+ })
113
+ .render();
114
+ </script>
115
+ ```
116
+
117
+ ## Sites that use D3plus
118
+
119
+ * [OEC.world](https://oec.world/)
120
+ * [Data USA](https://datausa.io/)
121
+ * [DataSaudi](https://datasaudi.sa/)
122
+ * [Healthy Communities NC](https://healthycommunitiesnc.org/)
123
+ * [Puerto Rico: Family Data Center](https://data.youthpr.org/en)
124
+ * [CNY Vitals Pro](https://pro.cnyvitals.org/)
125
+ * [CDC AR&PSP](https://arpsp.cdc.gov/)
126
+ * [DataMPE Brasil](https://datampe.sebrae.com.br/)
127
+ * [La Complejidad Económica en España - COTEC](https://complejidadeconomica.cotec.es/)
128
+ * [Data Africa](https://dataafrica.io/)
129
+ * [Pantheon](https://pantheon.world/)
130
+ * [Estonia Statistics](https://data.stat.ee/profile/country/ee/)