@wick-charts/vue 0.2.2 → 0.3.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.
- package/README.md +5 -3
- package/dist/index.d.ts +110 -19
- package/dist/index.js +1690 -1627
- package/package.json +28 -3
- package/src/BarSeries.vue +59 -0
- package/src/CandlestickSeries.vue +71 -0
- package/src/ChartContainer.vue +141 -0
- package/src/LineSeries.vue +59 -0
- package/src/PieSeries.vue +50 -0
- package/src/composables.ts +60 -0
- package/src/context.ts +31 -0
- package/src/index.ts +116 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/ui/Crosshair.vue +60 -0
- package/src/ui/InfoBar.vue +196 -0
- package/src/ui/Legend.vue +302 -0
- package/src/ui/NumberFlow.vue +98 -0
- package/src/ui/PieLegend.vue +126 -0
- package/src/ui/PieTooltip.vue +200 -0
- package/src/ui/TimeAxis.vue +92 -0
- package/src/ui/Title.vue +57 -0
- package/src/ui/Tooltip.vue +262 -0
- package/src/ui/YAxis.vue +100 -0
- package/src/ui/YLabel.vue +194 -0
package/README.md
CHANGED
|
@@ -143,9 +143,11 @@ import { createTheme } from '@wick-charts/vue';
|
|
|
143
143
|
|
|
144
144
|
const myTheme = createTheme({
|
|
145
145
|
background: '#1a1b2e',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
candlestick: {
|
|
147
|
+
up: { body: '#00d4aa' },
|
|
148
|
+
down: { body: '#ff5577' },
|
|
149
|
+
},
|
|
150
|
+
axis: { textColor: '#8888aa' },
|
|
149
151
|
});
|
|
150
152
|
```
|
|
151
153
|
|
package/dist/index.d.ts
CHANGED
|
@@ -416,6 +416,35 @@ declare interface AnimationsConfig {
|
|
|
416
416
|
*/
|
|
417
417
|
declare type AnimationTime = number | false;
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Build a 2-stop candle-body gradient around a single hex color — a lightened
|
|
421
|
+
* top stop and a darkened bottom stop. Presets use this to get a subtle
|
|
422
|
+
* vertical lift without hand-picking both ends.
|
|
423
|
+
*
|
|
424
|
+
* candlestick: { up: { body: autoGradient('#089981'), wick: '#089981' } }
|
|
425
|
+
*
|
|
426
|
+
* The input must be `#rrggbb`; other CSS color forms are returned as a flat
|
|
427
|
+
* `[color, color]` tuple because the lighten/darken math requires hex.
|
|
428
|
+
*
|
|
429
|
+
* The returned tuple carries the source color on a non-enumerable `source`
|
|
430
|
+
* property so {@link resolveCandlestickBodyColor} can recover it for scalar
|
|
431
|
+
* fallbacks (yLabel backgrounds, bands, volume tint) instead of picking the
|
|
432
|
+
* lightened top stop.
|
|
433
|
+
*/
|
|
434
|
+
export declare function autoGradient(color: string): AutoGradientTuple;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Tuple returned by {@link autoGradient}. The non-enumerable `source` property
|
|
438
|
+
* carries the original canonical color so scalar-fallback consumers
|
|
439
|
+
* (yLabel backgrounds, bands, default wick, volume tint) can recover it via
|
|
440
|
+
* {@link resolveCandlestickBodyColor} instead of picking the lightened top
|
|
441
|
+
* stop. `JSON.stringify` drops the marker, which is fine because
|
|
442
|
+
* `themeToJson` serializes all dependent scalar fields explicitly.
|
|
443
|
+
*/
|
|
444
|
+
declare type AutoGradientTuple = [string, string] & {
|
|
445
|
+
readonly source?: string;
|
|
446
|
+
};
|
|
447
|
+
|
|
419
448
|
/**
|
|
420
449
|
* Defines a bound for the Y axis.
|
|
421
450
|
*
|
|
@@ -537,6 +566,16 @@ export declare interface BuildLastSnapshotsArgs {
|
|
|
537
566
|
cacheKey: string;
|
|
538
567
|
}
|
|
539
568
|
|
|
569
|
+
/**
|
|
570
|
+
* `body` shape encodes the fill mode: a single color renders flat; a
|
|
571
|
+
* `[top, bottom]` tuple renders a 2-stop vertical gradient. Use
|
|
572
|
+
* `autoGradient(color)` for the subtle lightened/darkened look.
|
|
573
|
+
*/
|
|
574
|
+
declare interface CandlestickDirectionColors {
|
|
575
|
+
body: string | [string, string];
|
|
576
|
+
wick: string;
|
|
577
|
+
}
|
|
578
|
+
|
|
540
579
|
/**
|
|
541
580
|
* Entrance animation styles for candlesticks (shown when a new candle appears via `appendData`).
|
|
542
581
|
* - `'none'` — no animation.
|
|
@@ -554,16 +593,10 @@ export declare const CandlestickSeries: DefineComponent<__VLS_Props_2, {}, {}, {
|
|
|
554
593
|
export declare interface CandlestickSeriesOptions {
|
|
555
594
|
/** Display label shown in the tooltip. */
|
|
556
595
|
label?: string;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
wickUpColor: string;
|
|
560
|
-
wickDownColor: string;
|
|
596
|
+
up: CandlestickDirectionColors;
|
|
597
|
+
down: CandlestickDirectionColors;
|
|
561
598
|
/** Width of candle body as a fraction of the available bar slot (0-1). */
|
|
562
599
|
bodyWidthRatio: number;
|
|
563
|
-
/** Apply a subtle vertical gradient to candle bodies. Default: true. */
|
|
564
|
-
bodyGradient?: boolean;
|
|
565
|
-
/** @deprecated Use {@link bodyGradient} instead. */
|
|
566
|
-
candleGradient?: boolean;
|
|
567
600
|
/**
|
|
568
601
|
* Entrance animation style for newly appended candles. Style is specific to
|
|
569
602
|
* the candlestick; there is no chart-level override for style — only for
|
|
@@ -946,12 +979,23 @@ export declare interface ChartTheme {
|
|
|
946
979
|
color: string;
|
|
947
980
|
style: 'solid' | 'dashed' | 'dotted';
|
|
948
981
|
};
|
|
949
|
-
/**
|
|
982
|
+
/**
|
|
983
|
+
* OHLC candlestick colors. `wick` defaults to `body` in {@link createTheme}
|
|
984
|
+
* when omitted, so most presets only need to set the body colors.
|
|
985
|
+
*
|
|
986
|
+
* `body` shape encodes the fill: a single color renders flat; a
|
|
987
|
+
* `[top, bottom]` tuple renders a 2-stop vertical gradient. Presets that
|
|
988
|
+
* want the subtle lightened/darkened look pass `autoGradient(color)`.
|
|
989
|
+
*/
|
|
950
990
|
candlestick: {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
991
|
+
up: {
|
|
992
|
+
body: string | [string, string];
|
|
993
|
+
wick: string;
|
|
994
|
+
};
|
|
995
|
+
down: {
|
|
996
|
+
body: string | [string, string];
|
|
997
|
+
wick: string;
|
|
998
|
+
};
|
|
955
999
|
};
|
|
956
1000
|
/** Default line series appearance including area gradient fill. */
|
|
957
1001
|
line: {
|
|
@@ -973,12 +1017,27 @@ export declare interface ChartTheme {
|
|
|
973
1017
|
labelBackground: string;
|
|
974
1018
|
labelTextColor: string;
|
|
975
1019
|
};
|
|
976
|
-
/**
|
|
1020
|
+
/**
|
|
1021
|
+
* Axis tick styling. `fontSize` and `textColor` are the shared defaults used
|
|
1022
|
+
* for both X and Y, as well as non-axis label surfaces (legend, crosshair
|
|
1023
|
+
* labels, sparkline ticks). Set `x` / `y` only when a specific axis needs to
|
|
1024
|
+
* diverge.
|
|
1025
|
+
*/
|
|
977
1026
|
axis: {
|
|
1027
|
+
fontSize: number;
|
|
978
1028
|
textColor: string;
|
|
1029
|
+
x?: {
|
|
1030
|
+
fontSize?: number;
|
|
1031
|
+
textColor?: string;
|
|
1032
|
+
};
|
|
1033
|
+
y?: {
|
|
1034
|
+
fontSize?: number;
|
|
1035
|
+
textColor?: string;
|
|
1036
|
+
};
|
|
979
1037
|
};
|
|
980
1038
|
/** Floating label shown at the current value level on the Y axis. */
|
|
981
1039
|
yLabel: {
|
|
1040
|
+
fontSize: number;
|
|
982
1041
|
upBackground: string;
|
|
983
1042
|
downBackground: string;
|
|
984
1043
|
neutralBackground: string;
|
|
@@ -986,6 +1045,7 @@ export declare interface ChartTheme {
|
|
|
986
1045
|
};
|
|
987
1046
|
/** Hover tooltip styling. */
|
|
988
1047
|
tooltip: {
|
|
1048
|
+
fontSize: number;
|
|
989
1049
|
background: string;
|
|
990
1050
|
textColor: string;
|
|
991
1051
|
borderColor: string;
|
|
@@ -1499,6 +1559,36 @@ declare interface Rect {
|
|
|
1499
1559
|
height: number;
|
|
1500
1560
|
}
|
|
1501
1561
|
|
|
1562
|
+
/**
|
|
1563
|
+
* Resolve the effective font size for a given axis, falling back to the
|
|
1564
|
+
* shared `axis.fontSize` default when no per-axis override is set.
|
|
1565
|
+
*
|
|
1566
|
+
* Pass `'x'` or `'y'` for axis-specific surfaces (TimeAxis, YAxis). Omit the
|
|
1567
|
+
* argument for non-axis label surfaces that share the same size (Legend,
|
|
1568
|
+
* Crosshair label, Sparkline ticks).
|
|
1569
|
+
*/
|
|
1570
|
+
export declare function resolveAxisFontSize(theme: ChartTheme, axis?: 'x' | 'y'): number;
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Resolve the effective text color for a given axis, falling back to the
|
|
1574
|
+
* shared `axis.textColor` default when no per-axis override is set.
|
|
1575
|
+
*/
|
|
1576
|
+
export declare function resolveAxisTextColor(theme: ChartTheme, axis?: 'x' | 'y'): string;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Pick a single flat color from a candlestick body that may be either a single
|
|
1580
|
+
* color or a `[top, bottom]` gradient tuple. Use this wherever a solid color
|
|
1581
|
+
* is needed — tooltip text, legend swatches, sparkline trend indicator,
|
|
1582
|
+
* yLabel backgrounds, volume tinting, etc.
|
|
1583
|
+
*
|
|
1584
|
+
* For tuples produced by `autoGradient(c)` the canonical `c` is preserved on
|
|
1585
|
+
* a non-enumerable `source` property and returned as-is — this prevents the
|
|
1586
|
+
* lightened top stop from silently replacing the candle's perceived color
|
|
1587
|
+
* across dependent UI. Plain user tuples without a source fall back to the
|
|
1588
|
+
* top stop.
|
|
1589
|
+
*/
|
|
1590
|
+
export declare function resolveCandlestickBodyColor(body: string | [string, string]): string;
|
|
1591
|
+
|
|
1502
1592
|
export declare const rosePineDawn: ThemePreset;
|
|
1503
1593
|
|
|
1504
1594
|
export declare const sandDune: ThemePreset;
|
|
@@ -1559,7 +1649,10 @@ export declare interface ThemeConfig {
|
|
|
1559
1649
|
chartGradient?: [string, string];
|
|
1560
1650
|
typography?: Partial<ChartTheme['typography']>;
|
|
1561
1651
|
grid?: Partial<ChartTheme['grid']>;
|
|
1562
|
-
candlestick?:
|
|
1652
|
+
candlestick?: {
|
|
1653
|
+
up?: Partial<ChartTheme['candlestick']['up']>;
|
|
1654
|
+
down?: Partial<ChartTheme['candlestick']['down']>;
|
|
1655
|
+
};
|
|
1563
1656
|
line?: Partial<ChartTheme['line']>;
|
|
1564
1657
|
seriesColors?: string[];
|
|
1565
1658
|
bands?: Partial<ChartTheme['bands']>;
|
|
@@ -1696,13 +1789,11 @@ export declare interface TooltipPositionArgs {
|
|
|
1696
1789
|
offsetY?: number;
|
|
1697
1790
|
}
|
|
1698
1791
|
|
|
1699
|
-
/** Font family and size
|
|
1792
|
+
/** Font family and base font size used across the chart. */
|
|
1700
1793
|
export declare interface Typography {
|
|
1701
1794
|
fontFamily: string;
|
|
1795
|
+
/** Base body font size — titles, infobar, pie tooltip/legend default to this. */
|
|
1702
1796
|
fontSize: number;
|
|
1703
|
-
axisFontSize: number;
|
|
1704
|
-
yFontSize: number;
|
|
1705
|
-
tooltipFontSize: number;
|
|
1706
1797
|
}
|
|
1707
1798
|
|
|
1708
1799
|
export declare function useChartInstance(): ChartInstance;
|