@fundar/data-chart-telling 1.9.0 → 1.11.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 (59) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/configuration/config.svelte.js +1 -1
  3. package/dist/layout/base/BasePlotLayout.svelte +2 -1
  4. package/dist/layout/interaction/PlotInteraction.svelte.js +1 -1
  5. package/dist/layout/legend/DisabledStyle.d.ts +1 -1
  6. package/dist/layout/legend/DisabledStyle.js +9 -9
  7. package/dist/layout/plot/PlotContext.d.ts +3 -0
  8. package/dist/layout/plot/PlotContext.js +3 -0
  9. package/dist/layout/plot/PublicPlotContext.d.ts +2 -0
  10. package/dist/layout/plot/PublicPlotContext.js +4 -0
  11. package/dist/layout/styles/BasicStyles.d.ts +13 -0
  12. package/dist/layout/styles/BasicStyles.js +31 -0
  13. package/dist/markers/arrow/ArrowMarker.svelte +2 -0
  14. package/dist/markers/delta/Delta.d.ts +1 -1
  15. package/dist/markers/delta/Delta.js +2 -2
  16. package/dist/markers/delta/DeltaMarker.svelte +1 -1
  17. package/dist/markers/delta/DeltaPoint.svelte +31 -15
  18. package/dist/markers/rule/RuleMarker.svelte +2 -0
  19. package/dist/phases/data/DataPhase.js +5 -1
  20. package/dist/phases/transforms/TransformsPhase.js +2 -2
  21. package/dist/plots/correlation/heatmap/defaults.js +1 -1
  22. package/dist/plots/correlation/heatmap/markers.js +5 -1
  23. package/dist/plots/correlation/scatter/defaults.js +2 -1
  24. package/dist/plots/distribution/box/defaults.js +5 -1
  25. package/dist/plots/distribution/box/markers.js +9 -2
  26. package/dist/plots/distribution/density/defaults.js +7 -1
  27. package/dist/plots/distribution/density/markers.js +4 -0
  28. package/dist/plots/distribution/histogram/defaults.js +7 -1
  29. package/dist/plots/distribution/histogram/markers.js +10 -2
  30. package/dist/plots/distribution/pyramid/defaults.js +5 -1
  31. package/dist/plots/distribution/pyramid/markers.js +10 -1
  32. package/dist/plots/distribution/violin/defaults.js +5 -1
  33. package/dist/plots/distribution/violin/markers.js +4 -0
  34. package/dist/plots/evolution/area/defaults.js +3 -1
  35. package/dist/plots/evolution/area/markers.js +18 -9
  36. package/dist/plots/evolution/line/defaults.js +6 -1
  37. package/dist/plots/evolution/line/markers.d.ts +2 -2
  38. package/dist/plots/evolution/line/markers.js +5 -5
  39. package/dist/plots/evolution/slope/markers.js +1 -1
  40. package/dist/plots/ranking/bar/defaults.js +5 -1
  41. package/dist/plots/ranking/bar/markers.js +10 -2
  42. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +37 -12
  43. package/dist/plots/ranking/cleveland/defaults.js +4 -2
  44. package/dist/plots/utils/segments.d.ts +3 -1
  45. package/dist/plots/utils/segments.js +40 -19
  46. package/dist/types/configuration/styling.d.ts +1 -1
  47. package/dist/types/layout/legend.d.ts +1 -1
  48. package/dist/types/layout/styles/base.d.ts +27 -1
  49. package/dist/types/markers/axis/delta.d.ts +4 -4
  50. package/dist/types/phases/data/phase.d.ts +3 -0
  51. package/dist/types/phases/state.d.ts +2 -0
  52. package/dist/types/phases/transforms/phase.d.ts +2 -0
  53. package/dist/types/plots/segments/common.d.ts +2 -2
  54. package/docs/markers.md +1 -1
  55. package/docs/plots/ranking/dumbbell.md +1 -1
  56. package/docs/plots/ranking/lollipop.md +1 -1
  57. package/docs/styles-and-segments.md +32 -2
  58. package/examples/SegmentsBySeries.svelte +1 -1
  59. package/package.json +1 -1
@@ -103,6 +103,36 @@ A row whose value is `null`, `undefined` or `NaN` breaks a line. `styles.gaps` b
103
103
  - On bar plots only the presence of `x` matters.
104
104
  - Unset styles fall back to `line.gap`, `bar.gap` and `pyramid.gap` in the [configuration](theming.md).
105
105
 
106
+ ### Basic styles
107
+
108
+ `styles.stroke`, `styles.dot` and `styles.area` set the style every series is drawn with, so `segments` are left for what only part of a series looks like. Each takes a style as it is, or a function of the series' name returning one (`undefined` leaves that series as it is):
109
+
110
+ ```svelte
111
+ <LinePlot
112
+ styles={{
113
+ stroke: (name) =>
114
+ name === 'male' ? { strokeWidth: 2, strokeOpacity: 0.5 } : { strokeWidth: 4 },
115
+ dot: { dotRadius: 3 }
116
+ }}
117
+ ...
118
+ />
119
+ ```
120
+
121
+ - A plot uses the ones its own marks are made of and ignores the rest, so one `styles` can be shared between plots:
122
+
123
+ | Plot | Uses |
124
+ | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
125
+ | `LinePlot`, `SlopePlot`, `SparklinePlot` | `stroke` (the line), `dot` (a dot on every point; unset, none) |
126
+ | `AreaPlot`, `BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`, `BoxPlot`, `DensityPlot`, `ViolinPlot`, `HeatmapPlot` | `area` |
127
+ | `ScatterPlot` | `dot` |
128
+ | `LollipopPlot`, `DumbbellPlot`, `ClevelandPlot`, `ForestPlot` | `stroke` (the stems and connectors), `dot` |
129
+
130
+ `GeoPlot` has styles of its own and uses none of them.
131
+
132
+ - On the plots with connectors, `styles.stroke` (or a segment's `stroke`) styles the stems and connectors: width, color, opacity, dashes and line caps and joins. What the author sets for a connector wins over it: a segment's `stroke` wins over `styles.connector`, which wins over `styles.stroke`. A function of the series styles only the connector of a lone dot, which has a series; the connector of several dots takes a style as it is.
133
+ - A series keeps the color of the `color` scale unless the style sets its own.
134
+ - A segment's own style wins over them, field by field, and what a legend turned off dims over both - so a `legend.off` fades a series without `segments` repeating its opacity.
135
+
106
136
  ## Segments
107
137
 
108
138
  `segments` separates data ranges from their styling. It is an object: each key is a series name (a feature id for `GeoPlot`), or `'default'`, mapped to a list of segments.
@@ -125,7 +155,7 @@ The style shape depends on the plot:
125
155
 
126
156
  | Plot | Style type | Fields |
127
157
  | --------------------------- | ---------------------------------- | ---------------------------------------------- |
128
- | `LinePlot` | `LineSegmentStyle` | `stroke` (line style), `dots` (dot style) |
158
+ | `LinePlot` | `LineSegmentStyle` | `stroke` (line style), `dot` (dot style) |
129
159
  | `AreaPlot`, `HistogramPlot` | `AreaStyle` | `fill`, `fillOpacity`, `stroke`, ... |
130
160
  | `BarPlot`, `PyramidPlot` | `BarSegmentStyle` (`AreaStyle`) | `fill`, `fillOpacity`, `stroke`, ... |
131
161
  | `HeatmapPlot` | `CellSegmentStyle` (`AreaStyle`) | `fill`, `fillOpacity`, `stroke`, `strokeWidth` |
@@ -192,7 +222,7 @@ Per-series colors, plus dots over a range shared by every series:
192
222
  default: [
193
223
  {
194
224
  areas: [{ x: { from: 1965, to: 1980 } }],
195
- styles: { dots: { dotRadius: 5, dotSymbol: 'circle' } }
225
+ styles: { dot: { dotRadius: 5, dotSymbol: 'circle' } }
196
226
  }
197
227
  ]
198
228
  }}
@@ -18,7 +18,7 @@
18
18
  default: [
19
19
  {
20
20
  areas: [{ x: { from: 1965, to: 1980 } }],
21
- styles: { dots: { dotRadius: 5, dotSymbol: 'circle' } }
21
+ styles: { dot: { dotRadius: 5, dotSymbol: 'circle' } }
22
22
  }
23
23
  ]
24
24
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fundar/data-chart-telling",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Declarative charts, maps and small multiples for Svelte, built on svelteplot.",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",