diff --git a/docs/src/content/components/Bars.md b/docs/src/content/components/Bars.md index bad38792e..1c449ac46 100644 --- a/docs/src/content/components/Bars.md +++ b/docs/src/content/components/Bars.md @@ -5,7 +5,9 @@ layers: [svg, canvas] related: [Bar] --- -> See also: [BarChart](/docs/components/BarChart) for simplified examples +:::tip +See also: [BarChart](/docs/components/BarChart) for simplified examples +::: ## Usage diff --git a/docs/src/examples/components/AnnotationPoint/line-to-point.svelte b/docs/src/examples/components/AnnotationPoint/line-to-point.svelte index 3e59f4512..7f7f5971f 100644 --- a/docs/src/examples/components/AnnotationPoint/line-to-point.svelte +++ b/docs/src/examples/components/AnnotationPoint/line-to-point.svelte @@ -13,27 +13,39 @@ details: 'iPhone (1st Gen)' }, { - x: new Date('July 7, 2008'), + x: new Date('July 11, 2008'), y: 175.16, label: 'B', - details: 'iPad (1st Gen)' + details: 'iPhone 3G' }, { - x: new Date('January 27, 2010'), - y: 207.88, + x: new Date('April 3, 2010'), + y: 232.39, label: 'C', details: 'iPad (1st Gen)' }, + { + x: new Date('June 24, 2010'), + y: 254.28, + label: 'D', + details: 'iPhone 4' + }, + { + x: new Date('September 1, 2010'), + y: 258.77, + label: 'E', + details: 'Apple TV (2nd Gen)' + }, { x: new Date('March 11, 2011'), y: 352.47, - label: 'D', - details: 'iPad (1st Gen)' + label: 'F', + details: 'iPad (2nd Gen)' }, { x: new Date('March 7, 2012'), y: 545.18, - label: 'E', + label: 'G', details: 'Apple TV (3rd Gen)' } ]; diff --git a/docs/src/examples/components/AnnotationRange/hide-tooltip.svelte b/docs/src/examples/components/AnnotationRange/hide-tooltip.svelte index 1bc2df30f..8ffca5fd3 100644 --- a/docs/src/examples/components/AnnotationRange/hide-tooltip.svelte +++ b/docs/src/examples/components/AnnotationRange/hide-tooltip.svelte @@ -1,5 +1,5 @@ - + {#snippet aboveMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} diff --git a/docs/src/examples/components/AnnotationRange/horizontal-with-pattern-lower-bound.svelte b/docs/src/examples/components/AnnotationRange/horizontal-with-pattern-lower-bound.svelte index 59935be1a..538933833 100644 --- a/docs/src/examples/components/AnnotationRange/horizontal-with-pattern-lower-bound.svelte +++ b/docs/src/examples/components/AnnotationRange/horizontal-with-pattern-lower-bound.svelte @@ -1,5 +1,5 @@ - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart, type Placement } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding, type Placement } from 'layerchart'; import AnnotationRangeControls from '$lib/components/controls/AnnotationRangePointLineControls.svelte'; import { getAppleStock } from '$lib/data.remote'; @@ -26,7 +26,13 @@ - + {#snippet aboveMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} - import { AnnotationRange, LineChart } from 'layerchart'; + import { AnnotationRange, LineChart, defaultChartPadding } from 'layerchart'; import { getAppleStock } from '$lib/data.remote'; const data = await getAppleStock(); @@ -7,7 +7,13 @@ export { data }; - + {#snippet belowMarks({ context })} diff --git a/docs/src/examples/components/Area/multiple-series.svelte b/docs/src/examples/components/Area/multiple-series.svelte index f85779802..c7e6fedb9 100644 --- a/docs/src/examples/components/Area/multiple-series.svelte +++ b/docs/src/examples/components/Area/multiple-series.svelte @@ -46,7 +46,7 @@ cDomain={Object.keys(fruitColors)} cRange={Object.values(fruitColors)} tooltip={{ mode: 'quadtree' }} - padding={{ ...defaultChartPadding, top: 10, bottom: 10, left: 20, right: 60 }} + padding={defaultChartPadding({ top: 10, bottom: 15, left: 20, right: 60 })} height={300} > {#snippet children({ context })} diff --git a/docs/src/examples/components/Area/stack.svelte b/docs/src/examples/components/Area/stack.svelte index c31740b31..ac237af83 100644 --- a/docs/src/examples/components/Area/stack.svelte +++ b/docs/src/examples/components/Area/stack.svelte @@ -50,7 +50,7 @@ cDomain={Object.keys(fruitColors)} cRange={Object.values(fruitColors)} tooltip={{ mode: 'quadtree-x' }} - padding={{ ...defaultChartPadding, left: 25, bottom: 20 }} + padding={defaultChartPadding({ left: 25, bottom: 20, right: 15 })} height={300} > {#snippet children({ context })} diff --git a/docs/src/examples/components/AreaChart/custom.svelte b/docs/src/examples/components/AreaChart/custom.svelte index 0b0b4ce7b..19542670e 100644 --- a/docs/src/examples/components/AreaChart/custom.svelte +++ b/docs/src/examples/components/AreaChart/custom.svelte @@ -15,7 +15,7 @@ export { data }; - + {#snippet children({ context })} diff --git a/docs/src/examples/components/AreaChart/series-individual-tooltip.svelte b/docs/src/examples/components/AreaChart/series-individual-tooltip.svelte index 07225a9f7..ba98c6f9c 100644 --- a/docs/src/examples/components/AreaChart/series-individual-tooltip.svelte +++ b/docs/src/examples/components/AreaChart/series-individual-tooltip.svelte @@ -47,7 +47,7 @@ } ]} props={{ tooltip: { context: { mode: 'quadtree' } } }} - padding={defaultChartPadding({ right: 10 })} + padding={defaultChartPadding({ right: 15 })} height={300} > {#snippet marks({ series, context })} diff --git a/docs/src/examples/components/AreaChart/series-stack-legend-labels.svelte b/docs/src/examples/components/AreaChart/series-stack-legend-labels.svelte index 16a243807..b05162fa4 100644 --- a/docs/src/examples/components/AreaChart/series-stack-legend-labels.svelte +++ b/docs/src/examples/components/AreaChart/series-stack-legend-labels.svelte @@ -30,6 +30,6 @@ ]} legend seriesLayout="stack" - padding={defaultChartPadding({ bottom: 45, right: 10 })} + padding={defaultChartPadding({ legend: true, right: 10 })} height={300} /> diff --git a/docs/src/examples/components/AreaChart/series-stack-legend.svelte b/docs/src/examples/components/AreaChart/series-stack-legend.svelte index 97f387200..cef5fca75 100644 --- a/docs/src/examples/components/AreaChart/series-stack-legend.svelte +++ b/docs/src/examples/components/AreaChart/series-stack-legend.svelte @@ -28,6 +28,6 @@ ]} seriesLayout="stack" legend - padding={defaultChartPadding({ bottom: 45, right: 10 })} + padding={defaultChartPadding({ legend: true, right: 10 })} height={300} /> diff --git a/docs/src/examples/components/AreaChart/threshold-gradient.svelte b/docs/src/examples/components/AreaChart/threshold-gradient.svelte index 523b9efa5..de7b9556e 100644 --- a/docs/src/examples/components/AreaChart/threshold-gradient.svelte +++ b/docs/src/examples/components/AreaChart/threshold-gradient.svelte @@ -2,10 +2,10 @@ import { Area, AreaChart, - defaultChartPadding, Highlight, LinearGradient, - Tooltip + Tooltip, + defaultChartPadding } from 'layerchart'; import { createDateSeries } from '$lib/utils/data.js'; import { format } from '@layerstack/utils'; @@ -19,7 +19,7 @@ }; - + {#snippet marks({ context })} {@const thresholdValue = 0} {@const thresholdOffset = diff --git a/docs/src/examples/components/Axis/rotate-labels.svelte b/docs/src/examples/components/Axis/rotate-labels.svelte index 273b05779..8bb821e3f 100644 --- a/docs/src/examples/components/Axis/rotate-labels.svelte +++ b/docs/src/examples/components/Axis/rotate-labels.svelte @@ -1,12 +1,16 @@ - + - import { Axis, Chart, Layer } from 'layerchart'; + import { Axis, Chart, Layer, defaultChartPadding } from 'layerchart'; import { timeDay, timeHour, @@ -112,7 +112,10 @@
{example.label}
- + diff --git a/docs/src/examples/components/Axis/time-scale-auto.svelte b/docs/src/examples/components/Axis/time-scale-auto.svelte index f15379524..5a0d9de79 100644 --- a/docs/src/examples/components/Axis/time-scale-auto.svelte +++ b/docs/src/examples/components/Axis/time-scale-auto.svelte @@ -1,5 +1,5 @@ - + {#snippet aboveMarks()} 0} value="date" class="text-sm fill-surface-300 stroke-none" /> {/snippet} diff --git a/docs/src/examples/components/Bars/horizontal-grouped-and-stacked.svelte b/docs/src/examples/components/Bars/horizontal-grouped-and-stacked.svelte index f1eb5c5f1..3c492d998 100644 --- a/docs/src/examples/components/Bars/horizontal-grouped-and-stacked.svelte +++ b/docs/src/examples/components/Bars/horizontal-grouped-and-stacked.svelte @@ -1,7 +1,16 @@ -
- { - yDomain = e.yDomain; - } - }} - height={300} - > - - - - - - {#snippet children({ gradient })} - - {/snippet} - - - - -
+ { + yDomain = e.yDomain; + } + }} + height={300} +> + + + + + + {#snippet children({ gradient })} + + {/snippet} + + + + diff --git a/docs/src/examples/components/BrushContext/minimap.svelte b/docs/src/examples/components/BrushContext/minimap.svelte index 4b039f144..42de0b0e1 100644 --- a/docs/src/examples/components/BrushContext/minimap.svelte +++ b/docs/src/examples/components/BrushContext/minimap.svelte @@ -1,6 +1,15 @@ - + scale.ticks?.().filter(Number.isInteger)} /> diff --git a/docs/src/examples/components/LineChart/series-individual-tooltip.svelte b/docs/src/examples/components/LineChart/series-individual-tooltip.svelte index dfa39d761..fe1242289 100644 --- a/docs/src/examples/components/LineChart/series-individual-tooltip.svelte +++ b/docs/src/examples/components/LineChart/series-individual-tooltip.svelte @@ -38,7 +38,7 @@ props={{ tooltip: { context: { mode: 'quadtree' } } }} brush legend - padding={defaultChartPadding({ right: 10 })} + padding={defaultChartPadding({ legend: true, right: 10 })} height={300} > {#snippet marks({ context, visibleSeries, highlightKey })} diff --git a/docs/src/examples/components/Rule/data-x-band.svelte b/docs/src/examples/components/Rule/data-x-band.svelte index 61e46717c..16115089d 100644 --- a/docs/src/examples/components/Rule/data-x-band.svelte +++ b/docs/src/examples/components/Rule/data-x-band.svelte @@ -37,14 +37,7 @@ export { data }; - + diff --git a/docs/src/examples/components/Tooltip/anchor-location.svelte b/docs/src/examples/components/Tooltip/anchor-location.svelte index 36c62bc9e..64e39979b 100644 --- a/docs/src/examples/components/Tooltip/anchor-location.svelte +++ b/docs/src/examples/components/Tooltip/anchor-location.svelte @@ -1,7 +1,7 @@