manim-web 0.24.0 → 0.26.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 (55) hide show
  1. package/dist/export/SlideDeckExporter.d.ts +210 -0
  2. package/dist/export/SlideDeckExporter.d.ts.map +1 -0
  3. package/dist/export/index.d.ts +1 -0
  4. package/dist/export/index.d.ts.map +1 -1
  5. package/dist/html2canvas-DECPJJGt.js +4025 -0
  6. package/dist/index.d.ts +6 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.es-BiZp4vgJ.js +5753 -0
  9. package/dist/index.js +3 -3
  10. package/dist/integrations/react.js +17 -17
  11. package/dist/integrations/vue.js +16 -16
  12. package/dist/jspdf.es.min-CvMJL6nS.js +18228 -0
  13. package/dist/manim-web.browser.js +3854 -1651
  14. package/dist/mobjects/graph/ForceDirectedLayout.d.ts +65 -0
  15. package/dist/mobjects/graph/ForceDirectedLayout.d.ts.map +1 -0
  16. package/dist/mobjects/graph/GenericGraph.d.ts +11 -0
  17. package/dist/mobjects/graph/GenericGraph.d.ts.map +1 -1
  18. package/dist/mobjects/graph/SankeyDiagram.d.ts +122 -0
  19. package/dist/mobjects/graph/SankeyDiagram.d.ts.map +1 -0
  20. package/dist/mobjects/graph/index.d.ts +4 -1
  21. package/dist/mobjects/graph/index.d.ts.map +1 -1
  22. package/dist/mobjects/graph/layoutAlgorithms.d.ts +54 -0
  23. package/dist/mobjects/graph/layoutAlgorithms.d.ts.map +1 -1
  24. package/dist/mobjects/graph/sankeyLayout.d.ts +97 -0
  25. package/dist/mobjects/graph/sankeyLayout.d.ts.map +1 -0
  26. package/dist/mobjects/graphing/AreaChart.d.ts +101 -0
  27. package/dist/mobjects/graphing/AreaChart.d.ts.map +1 -0
  28. package/dist/mobjects/graphing/CalendarHeatmap.d.ts +111 -0
  29. package/dist/mobjects/graphing/CalendarHeatmap.d.ts.map +1 -0
  30. package/dist/mobjects/graphing/ChordDiagram.d.ts +122 -0
  31. package/dist/mobjects/graphing/ChordDiagram.d.ts.map +1 -0
  32. package/dist/mobjects/graphing/DomainColoring.d.ts +114 -0
  33. package/dist/mobjects/graphing/DomainColoring.d.ts.map +1 -0
  34. package/dist/mobjects/graphing/RadarChart.d.ts +135 -0
  35. package/dist/mobjects/graphing/RadarChart.d.ts.map +1 -0
  36. package/dist/mobjects/graphing/StackedBarChart.d.ts +131 -0
  37. package/dist/mobjects/graphing/StackedBarChart.d.ts.map +1 -0
  38. package/dist/mobjects/graphing/StepChart.d.ts +90 -0
  39. package/dist/mobjects/graphing/StepChart.d.ts.map +1 -0
  40. package/dist/mobjects/graphing/Treemap.d.ts +100 -0
  41. package/dist/mobjects/graphing/Treemap.d.ts.map +1 -0
  42. package/dist/mobjects/graphing/WaterfallChart.d.ts +164 -0
  43. package/dist/mobjects/graphing/WaterfallChart.d.ts.map +1 -0
  44. package/dist/mobjects/graphing/chartColors.d.ts +18 -0
  45. package/dist/mobjects/graphing/chartColors.d.ts.map +1 -0
  46. package/dist/mobjects/graphing/chordLayout.d.ts +89 -0
  47. package/dist/mobjects/graphing/chordLayout.d.ts.map +1 -0
  48. package/dist/mobjects/graphing/index.d.ts +12 -0
  49. package/dist/mobjects/graphing/index.d.ts.map +1 -1
  50. package/dist/mobjects/graphing/treemapLayout.d.ts +83 -0
  51. package/dist/mobjects/graphing/treemapLayout.d.ts.map +1 -0
  52. package/dist/purify.es-MUrypqLF.js +864 -0
  53. package/dist/{src-DRH8XOAP.js → src-B2lipHn1.js} +3836 -1633
  54. package/dist/typeof-CcP5rTWg.js +11 -0
  55. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalendarHeatmap.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/CalendarHeatmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,S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,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS;IAInD,mDAAmD;IACnD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY;IAI/C,4CAA4C;IAC5C,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI3B,IAAI,IAAI,eAAe;CAmBjC"}
@@ -0,0 +1,122 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { VMobject } from '../../core/VMobject';
3
+ import { AnnularSector } from '../geometry/AnnularSector';
4
+ import { ChordFlow, ChordGroupArc, ChordLayout, ChordRibbonSpan } from './chordLayout';
5
+ /**
6
+ * A single group arc of a {@link ChordDiagram}.
7
+ */
8
+ export declare class ChordArc extends AnnularSector {
9
+ /** Group index. */
10
+ readonly groupIndex: number;
11
+ /** Total flow of the group. */
12
+ readonly total: number;
13
+ constructor(options: ConstructorParameters<typeof AnnularSector>[0] & {
14
+ groupIndex: number;
15
+ total: number;
16
+ });
17
+ }
18
+ /**
19
+ * A single flow ribbon of a {@link ChordDiagram}.
20
+ *
21
+ * The ribbon is a closed filled VMobject: an arc along the source span, a
22
+ * bezier through the center to the target span, an arc along it, and a bezier
23
+ * back. The source and target span angles are proportional to the flow values.
24
+ */
25
+ export declare class ChordRibbon extends VMobject {
26
+ /** Source group index. */
27
+ readonly source: number;
28
+ /** Target group index. */
29
+ readonly target: number;
30
+ /** Flow on the source side. */
31
+ readonly sourceValue: number;
32
+ /** Flow on the target side. */
33
+ readonly targetValue: number;
34
+ private readonly _sourceSpanAngle;
35
+ private readonly _targetSpanAngle;
36
+ constructor(span: ChordRibbonSpan, radius: number, color: string, fillOpacity: number);
37
+ /** Angular width of the source span, proportional to {@link sourceValue}. */
38
+ getSourceSpanAngle(): number;
39
+ /** Angular width of the target span, proportional to {@link targetValue}. */
40
+ getTargetSpanAngle(): number;
41
+ }
42
+ /**
43
+ * Options for {@link ChordDiagram}.
44
+ */
45
+ export interface ChordDiagramOptions {
46
+ /** Square flow matrix. `matrix[i][j]` is the flow from group i to group j. */
47
+ matrix?: number[][];
48
+ /** Link-list input, used with `groupCount` when `matrix` is omitted. */
49
+ flows?: ChordFlow[];
50
+ /** Number of groups, required with `flows`. */
51
+ groupCount?: number;
52
+ /** Group labels, by index. Default: []. */
53
+ labels?: string[];
54
+ /** Inner radius of the ring (ribbons are drawn inside it). Default: 2.5. */
55
+ radius?: number;
56
+ /** Thickness of the group ring. Default: 0.25. */
57
+ ringWidth?: number;
58
+ /** Angular gap between groups, in radians. Default: 0.05. */
59
+ gap?: number;
60
+ /** Angle of the first group's start edge, in radians. Default: Math.PI / 2. */
61
+ startAngle?: number;
62
+ /** Group colors. Single color applies to all, array cycles. Default: Manim palette. */
63
+ colors?: string | string[];
64
+ /** Fill opacity of the group arcs. Default: 1. */
65
+ arcOpacity?: number;
66
+ /** Fill opacity of the ribbons. Default: 0.6. */
67
+ ribbonOpacity?: number;
68
+ /** Whether to draw group labels. Default: true when labels are given. */
69
+ showLabels?: boolean;
70
+ /** Font size for group labels. Default: 20. */
71
+ labelFontSize?: number;
72
+ /** Gap between the ring and a label. Default: 0.3. */
73
+ labelBuff?: number;
74
+ }
75
+ /**
76
+ * ChordDiagram - arcs around a circle linked by proportional ribbons.
77
+ *
78
+ * Each group becomes an {@link ChordArc} whose angle is proportional to the
79
+ * group's total flow. Each non-zero flow pair becomes a {@link ChordRibbon}
80
+ * whose span angles are proportional to the flow values. Empty, single-group,
81
+ * and zero-value inputs produce no error.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const chord = new ChordDiagram({
86
+ * matrix: [
87
+ * [0, 3, 1],
88
+ * [3, 0, 2],
89
+ * [1, 2, 0],
90
+ * ],
91
+ * labels: ['A', 'B', 'C'],
92
+ * });
93
+ * chord.getArc(0); // the first group arc
94
+ * ```
95
+ */
96
+ export declare class ChordDiagram extends VGroup {
97
+ /** The group arcs. */
98
+ arcs: VGroup;
99
+ /** The flow ribbons. */
100
+ chords: VGroup;
101
+ /** The group labels. */
102
+ labelGroup: VGroup;
103
+ protected _options: ChordDiagramOptions;
104
+ protected _layout: ChordLayout;
105
+ protected _arcs: ChordArc[];
106
+ protected _chords: ChordRibbon[];
107
+ constructor(options: ChordDiagramOptions);
108
+ /** Build a label for each group at its mid-angle, outside the ring. */
109
+ protected _buildLabels(groups: ChordGroupArc[], labels: string[], labelRadius: number, fontSize: number): void;
110
+ /** All group arcs, in group order. */
111
+ getArcs(): ChordArc[];
112
+ /** The arc for a group index, or undefined when out of range. */
113
+ getArc(index: number): ChordArc | undefined;
114
+ /** All flow ribbons, in layout order. */
115
+ getChords(): ChordRibbon[];
116
+ /** The ribbon at the given index, or undefined when out of range. */
117
+ getChord(index: number): ChordRibbon | undefined;
118
+ /** The computed layout (arcs and ribbon spans). */
119
+ getLayout(): ChordLayout;
120
+ copy(): ChordDiagram;
121
+ }
122
+ //# sourceMappingURL=ChordDiagram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChordDiagram.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/ChordDiagram.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAa1D,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AA8DvB;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAa;IACzC,mBAAmB;IACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG;QACxD,UAAU,EAAE,MAAM,CAAC;Q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,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACtC,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACxC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC;IAC/B,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAM;IACjC,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,CAAM;gBAE1B,OAAO,EAAE,mBAAmB;IAgExC,uEAAuE;IACvE,SAAS,CAAC,YAAY,CACpB,MAAM,EAAE,aAAa,EAAE,EACvB,MAAM,EAAE,MAAM,EAAE,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,IAAI;IAYP,sCAAsC;IACtC,OAAO,IAAI,QAAQ,EAAE;IAIrB,iEAAiE;IACjE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAI3C,yCAAyC;IACzC,SAAS,IAAI,WAAW,EAAE;IAI1B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIhD,mDAAmD;IACnD,SAAS,IAAI,WAAW;IAQf,IAAI,IAAI,YAAY;CAK9B"}
@@ -0,0 +1,114 @@
1
+ import { Vector3Tuple } from '../../core/Mobject';
2
+ import { Mobject3D } from '../three-d/Mobject3D';
3
+ import { Complex } from './ComplexPlane';
4
+ import * as THREE from 'three';
5
+ /** A complex function w = f(z), mapping one complex number to another. */
6
+ export type ComplexFunction = (z: Complex) => Complex;
7
+ /**
8
+ * How the modulus |f(z)| drives brightness.
9
+ *
10
+ * - `smooth`: brightness rises monotonically with the modulus, dark at zeros
11
+ * and bright at poles.
12
+ * - `banded`: brightness oscillates over each octave (power of two) of the
13
+ * modulus, giving the dark/light contour bands of a Wegert phase portrait.
14
+ */
15
+ export type BrightnessScheme = 'smooth' | 'banded';
16
+ /** Options for creating a {@link DomainColoring}. */
17
+ export interface DomainColoringOptions {
18
+ /** The complex function w = f(z) to visualize. */
19
+ func: ComplexFunction;
20
+ /** Real-axis range [min, max]. Default: [-5, 5] */
21
+ reRange?: [number, number];
22
+ /** Imaginary-axis range [min, max]. Default: [-5, 5] */
23
+ imRange?: [number, number];
24
+ /** Pixel grid size per axis, or [width, height]. Default: 256 */
25
+ resolution?: number | [number, number];
26
+ /** Brightness scheme for the modulus. Default: 'banded' */
27
+ scheme?: BrightnessScheme;
28
+ /** Color saturation from 0 to 1. Default: 1 */
29
+ saturation?: number;
30
+ /** Darken thin lines where the modulus crosses a power of two. Default: false */
31
+ contourLines?: boolean;
32
+ /** Opacity from 0 to 1. Default: 1 */
33
+ opacity?: number;
34
+ /** Center position [x, y, z]. Default: [0, 0, 0] */
35
+ center?: Vector3Tuple;
36
+ }
37
+ /**
38
+ * Map an evaluated value w = f(z) to an `[r, g, b]` float color (0..1).
39
+ *
40
+ * The hue encodes arg(w): the positive real axis is hue 0, and a quarter turn
41
+ * toward the positive imaginary axis shifts the hue by 90 degrees. The modulus
42
+ * |w| drives brightness through the chosen scheme. The result is always a valid
43
+ * color: a pole (|w| not finite) reads bright, a zero reads dark, and any
44
+ * non-finite channel becomes 0, so poles and zeros never produce NaN colors.
45
+ */
46
+ export declare function phasePortraitColor(w: Complex, scheme: BrightnessScheme, saturation: number, contourLines: boolean): [number, number, number];
47
+ /**
48
+ * DomainColoring - a phase portrait of a complex function f: C -> C.
49
+ *
50
+ * The region of the complex plane is sampled on a regular pixel grid. Each
51
+ * pixel's complex value w = f(z) is turned into a color by {@link
52
+ * phasePortraitColor}: the hue encodes arg(w) and the brightness encodes |w|.
53
+ * The pixels are written to an RGBA buffer that is uploaded as a texture on a
54
+ * flat quad spanning `reRange` x `imRange`, mirroring the way {@link HeatMap}
55
+ * renders a sampled scalar field.
56
+ *
57
+ * The pixel buffer is computed in plain TypeScript, so it is deterministic and
58
+ * readable without a browser. In a browser the buffer becomes a
59
+ * `THREE.CanvasTexture`; without a DOM it becomes an equivalent
60
+ * `THREE.DataTexture`.
61
+ *
62
+ * Pixel layout: row 0 is the top (im = imMax), the last row is the bottom
63
+ * (im = imMin); column 0 is the left (re = reMin), the last column is the
64
+ * right (re = reMax).
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * // The identity f(z) = z
69
+ * const portrait = new DomainColoring({
70
+ * func: (z) => z,
71
+ * reRange: [-2, 2],
72
+ * imRange: [-2, 2],
73
+ * resolution: 256,
74
+ * });
75
+ * ```
76
+ */
77
+ export declare class DomainColoring extends Mobject3D {
78
+ private _func;
79
+ private _reRange;
80
+ private _imRange;
81
+ private _width;
82
+ private _height;
83
+ private _scheme;
84
+ private _saturation;
85
+ private _contourLines;
86
+ private _centerPoint;
87
+ constructor(options: DomainColoringOptions);
88
+ /** The complex number z sampled at pixel column `col`, row `row`. */
89
+ pixelToComplex(col: number, row: number): Complex;
90
+ /** Sample the function over the grid into an RGBA buffer (row 0 at the top). */
91
+ getPixelData(): Uint8ClampedArray;
92
+ /** The pixel grid size as [width, height]. */
93
+ getResolution(): [number, number];
94
+ /** The hex color the portrait assigns to the complex number `z`. */
95
+ colorAt(z: Complex): string;
96
+ /** Build a texture from the pixel buffer, preferring a canvas when a DOM exists. */
97
+ private _buildTexture;
98
+ /** Build the textured quad spanning reRange x imRange. */
99
+ private _buildGeometry;
100
+ protected _createThreeObject(): THREE.Object3D;
101
+ protected _syncMaterialToThree(): void;
102
+ /** Rebuild the geometry and texture after the function or options change. */
103
+ private _update;
104
+ /** Get the complex function. */
105
+ getFunc(): ComplexFunction;
106
+ /** Set the complex function and rebuild. */
107
+ setFunc(func: ComplexFunction): this;
108
+ /** The brightness scheme in use. */
109
+ getScheme(): BrightnessScheme;
110
+ /** Set the brightness scheme and rebuild. */
111
+ setScheme(scheme: BrightnessScheme): this;
112
+ copy(): DomainColoring;
113
+ }
114
+ //# sourceMappingURL=DomainColoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainColoring.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/DomainColoring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEnD,qDAAqD;AACrD,MAAM,WAAW,qBAAqB;IACpC,kDAAkD;IAClD,IAAI,EAAE,eAAe,CAAC;IACtB,mDAAmD;IACnD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,wDAAwD;IACxD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sCAAsC;IACtC,OAAO,CAAC,EAAE,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AAoC;IACpC,SAAS,IAAI,gBAAgB;IAI7B,6CAA6C;IAC7C,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAMhC,IAAI,IAAI,cAAc;CAehC"}
@@ -0,0 +1,135 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { Vector3Tuple } from '../../core/Mobject';
3
+ import { Polygon } from '../geometry/Polygon';
4
+ /**
5
+ * Options for creating a RadarChart.
6
+ */
7
+ export interface RadarChartOptions {
8
+ /** Values per category. One series is number[], several series are number[][]. */
9
+ data: number[] | number[][];
10
+ /** Axis (category) labels, one per axis. Default: [] */
11
+ categories?: string[];
12
+ /** Value that reaches the outer ring. Default: the largest value in the data. */
13
+ maxValue?: number;
14
+ /** Radius of the outer ring. Default: 3 */
15
+ radius?: number;
16
+ /** Number of concentric grid rings. Default: 5 */
17
+ numRings?: number;
18
+ /** Color per series. Single color applies to all, array cycles. Default: Manim palette. */
19
+ seriesColors?: string | string[];
20
+ /** Fill opacity of each series polygon. Default: 0.3 */
21
+ fillOpacity?: number;
22
+ /** Stroke width of each series polygon. Default: 3 */
23
+ strokeWidth?: number;
24
+ /** Whether to draw the rings and spokes. Default: true */
25
+ showGrid?: boolean;
26
+ /** Whether to draw the category labels. Default: true */
27
+ showLabels?: boolean;
28
+ /** Font size for the category labels. Default: 20 */
29
+ labelFontSize?: number;
30
+ /** Color for the grid rings, spokes and labels. Default: gray. */
31
+ gridColor?: string;
32
+ /** Angle of the first axis in radians. Default: Math.PI / 2 (straight up). */
33
+ startAngle?: number;
34
+ }
35
+ /**
36
+ * RadarChart - A radar (spider) chart mobject.
37
+ *
38
+ * Draws N axes that radiate from a shared center, one per category, spaced at
39
+ * 2*pi/N. Each value is plotted at a radius proportional to the value along its
40
+ * axis, and the points of a series connect into a closed polygon. Several series
41
+ * overlay on the same axes, each with its own color and a semi-transparent fill.
42
+ *
43
+ * Negative values clamp to the center (radius 0). A value equal to maxValue sits
44
+ * on the outer ring.
45
+ *
46
+ * The chart is a VGroup, so Create and FadeIn animate it directly.
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const chart = new RadarChart({
51
+ * data: [
52
+ * [4, 2, 5, 1, 3],
53
+ * [1, 5, 2, 4, 2],
54
+ * ],
55
+ * categories: ['Speed', 'Power', 'Range', 'Cost', 'Weight'],
56
+ * });
57
+ * scene.play(new Create(chart));
58
+ * ```
59
+ */
60
+ export declare class RadarChart extends VGroup {
61
+ /** The concentric grid rings. */
62
+ grid: VGroup;
63
+ /** The axis spoke lines, one per category. */
64
+ axes: VGroup;
65
+ /** The series polygons. */
66
+ series: VGroup;
67
+ /** The category labels. */
68
+ labels: VGroup;
69
+ protected _series: number[][];
70
+ protected _categories: string[];
71
+ protected _maxValue: number;
72
+ protected _radius: number;
73
+ protected _numRings: number;
74
+ protected _seriesColors: string[];
75
+ protected _fillOpacity: number;
76
+ protected _strokeWidth: number;
77
+ protected _showGrid: boolean;
78
+ protected _showLabels: boolean;
79
+ protected _labelFontSize: number;
80
+ protected _gridColor: string;
81
+ protected _startAngle: number;
82
+ constructor(options: RadarChartOptions);
83
+ /** Normalize data to a 2D array (series x categories). */
84
+ private _normalizeData;
85
+ /** Largest value across all series, or 1 when nothing is positive. */
86
+ private _autoMaxValue;
87
+ /** Number of axes (categories). */
88
+ private get _numAxes();
89
+ /** Color for series s, cycling through the palette. */
90
+ private _seriesColor;
91
+ /**
92
+ * Angle in radians of axis k, measured from the positive x-axis.
93
+ * Axes are spaced 2*pi/N counter-clockwise from startAngle.
94
+ */
95
+ getAxisAngle(categoryIndex: number): number;
96
+ /** Radius for a value, clamped to [0, infinity): negatives sit at the center. */
97
+ private _valueToRadius;
98
+ /**
99
+ * Plotted point for the value of series s at category k, in chart coordinates
100
+ * (the chart is centered on the origin).
101
+ */
102
+ getPointForValue(seriesIndex: number, categoryIndex: number): Vector3Tuple;
103
+ /** Point on the outer ring along axis k. */
104
+ private _outerPoint;
105
+ /** Build the concentric grid rings (one polygon per ring). */
106
+ private _createGrid;
107
+ /** Build one spoke line per axis, from the center to the outer ring. */
108
+ private _createSpokes;
109
+ /** Build one closed polygon per series. */
110
+ private _createSeries;
111
+ /** Build the category labels, placed just beyond the outer ring. */
112
+ private _createLabels;
113
+ /** Get the polygon for series i, or undefined when out of range. */
114
+ getSeriesPolygon(seriesIndex: number): Polygon | undefined;
115
+ /** Get the group of axis spoke lines. */
116
+ getAxes(): VGroup;
117
+ /** Get the group of grid rings. */
118
+ getGrid(): VGroup;
119
+ /** Get the group of series polygons. */
120
+ getSeries(): VGroup;
121
+ /** Get the group of category labels. */
122
+ getLabels(): VGroup;
123
+ /** Number of axes (categories). */
124
+ getNumAxes(): number;
125
+ /** Number of series. */
126
+ getNumSeries(): number;
127
+ /** The value that reaches the outer ring. */
128
+ getMaxValue(): number;
129
+ /** The outer ring radius. */
130
+ getOuterRadius(): number;
131
+ /** Get the data as a 2D array (series x categories). */
132
+ getData(): number[][];
133
+ copy(): RadarChart;
134
+ }
135
+ //# sourceMappingURL=RadarChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadarChart.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/RadarChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAQ9C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;IAC5B,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;I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AAE,MAAM,CAAC;gBAElB,OAAO,EAAE,iBAAiB;IAsDtC,0DAA0D;IAC1D,OAAO,CAAC,cAAc;IAQtB,sEAAsE;IACtE,OAAO,CAAC,aAAa;IAUrB,mCAAmC;IACnC,OAAO,KAAK,QAAQ,GAEnB;IAED,uDAAuD;IACvD,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAM3C,iFAAiF;IACjF,OAAO,CAAC,cAAc;IAKtB;;;OAGG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,YAAY;IAO1E,4CAA4C;IAC5C,OAAO,CAAC,WAAW;IAKnB,8DAA8D;IAC9D,OAAO,CAAC,WAAW;IAsBnB,wEAAwE;IACxE,OAAO,CAAC,aAAa;IAYrB,2CAA2C;IAC3C,OAAO,CAAC,aAAa;IAwBrB,oEAAoE;IACpE,OAAO,CAAC,aAAa;IAkBrB,oEAAoE;IACpE,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI1D,yCAAyC;IACzC,OAAO,IAAI,MAAM;IAIjB,mCAAmC;IACnC,OAAO,IAAI,MAAM;IAIjB,wCAAwC;IACxC,SAAS,IAAI,MAAM;IAInB,wCAAwC;IACxC,SAAS,IAAI,MAAM;IAInB,mCAAmC;IACnC,UAAU,IAAI,MAAM;IAIpB,wBAAwB;IACxB,YAAY,IAAI,MAAM;IAItB,6CAA6C;IAC7C,WAAW,IAAI,MAAM;IAIrB,6BAA6B;IAC7B,cAAc,IAAI,MAAM;IAIxB,wDAAwD;IACxD,OAAO,IAAI,MAAM,EAAE,EAAE;IAIZ,IAAI,IAAI,UAAU;CAmB5B"}
@@ -0,0 +1,131 @@
1
+ import { Group } from '../../core/Group';
2
+ import { VGroup } from '../../core/VGroup';
3
+ import { VMobject } from '../../core/VMobject';
4
+ import { Rectangle } from '../geometry/Rectangle';
5
+ /** How a StackedBarChart arranges the bars of each category. */
6
+ export type BarChartMode = 'stacked' | 'grouped';
7
+ /** Options for creating a StackedBarChart. */
8
+ export interface StackedBarChartOptions {
9
+ /** Values as a 2D array [series][category]. A flat array is treated as one series. */
10
+ values: number[][] | number[];
11
+ /** 'stacked' cumulates series; 'grouped' places them side by side. Default: 'stacked' */
12
+ mode?: BarChartMode;
13
+ /** Width of a category slot (stacked) or the full group (grouped). Default: 0.8 */
14
+ slotWidth?: number;
15
+ /** Gap kept empty on each side of a category slot. Default: 0.2 */
16
+ categoryGap?: number;
17
+ /** Gap between bars of a group (grouped mode). Default: 0.05 */
18
+ seriesGap?: number;
19
+ /** Series colors. Single color applies to all, array cycles. Default: Manim palette */
20
+ seriesColors?: string | string[];
21
+ /** Series names for the legend. Default: [] */
22
+ seriesNames?: string[];
23
+ /** Whether to draw a legend. Default: false */
24
+ showLegend?: boolean;
25
+ /** Fill opacity for the bars. Default: 0.85 */
26
+ fillOpacity?: number;
27
+ /** Stroke width for the bar outlines. Default: 1.5 */
28
+ strokeWidth?: number;
29
+ /** X-axis labels, one per category. Default: [] */
30
+ xLabels?: string[];
31
+ /** Font size for x-axis labels. Default: 22 */
32
+ xLabelFontSize?: number;
33
+ /** Y-axis range as [min, max, step]. Default: auto-computed */
34
+ yRange?: [number, number, number];
35
+ /** Visual height of the chart area. Default: 5 */
36
+ height?: number;
37
+ /** Visual width of the chart area. Default: 8 */
38
+ width?: number;
39
+ /** Color for the axes and labels. Default: white */
40
+ axisColor?: string;
41
+ }
42
+ /**
43
+ * StackedBarChart - a multi-series bar chart with stacked or grouped bars.
44
+ *
45
+ * In `stacked` mode each category shows its series piled on top of one another,
46
+ * so bar `i` sits on the cumulative sum of the series below it. In `grouped`
47
+ * mode the series sit side by side within each category with no overlap.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const chart = new StackedBarChart({
52
+ * values: [[3, 7, 2], [5, 4, 6]],
53
+ * mode: 'stacked',
54
+ * xLabels: ['Q1', 'Q2', 'Q3'],
55
+ * seriesNames: ['2023', '2024'],
56
+ * showLegend: true,
57
+ * });
58
+ * ```
59
+ */
60
+ export declare class StackedBarChart extends Group {
61
+ /** All bars, in series-major order. */
62
+ bars: VGroup;
63
+ /** X-axis labels. */
64
+ xLabels: VGroup;
65
+ /** Y-axis labels. */
66
+ yLabels: VGroup;
67
+ /** The x-axis baseline. */
68
+ xAxisLine: VMobject;
69
+ /** The y-axis line. */
70
+ yAxisLine: VMobject;
71
+ /** Legend, when enabled. */
72
+ legend: VGroup | null;
73
+ protected _values: number[][];
74
+ protected _mode: BarChartMode;
75
+ protected _slotWidth: number;
76
+ protected _categoryGap: number;
77
+ protected _seriesGap: number;
78
+ protected _colors: string[];
79
+ protected _seriesNames: string[];
80
+ protected _showLegend: boolean;
81
+ protected _fillOpacity: number;
82
+ protected _strokeWidth: number;
83
+ protected _xLabelTexts: string[];
84
+ protected _xLabelFontSize: number;
85
+ protected _yRange: [number, number, number];
86
+ protected _height: number;
87
+ protected _width: number;
88
+ protected _axisColor: string;
89
+ /** Bars indexed [series][category]. */
90
+ protected _barGrid: Rectangle[][];
91
+ constructor(options: StackedBarChartOptions);
92
+ /** Coerce the input into a [series][category] grid with equal category counts. */
93
+ private _normalize;
94
+ private get _numSeries();
95
+ private get _numCategories();
96
+ /** Auto value range from the data, accounting for the stacking mode. */
97
+ private _computeYRange;
98
+ /** Map a data value to a y-coordinate in the chart frame. */
99
+ valueToY(value: number): number;
100
+ /** The y-coordinate of the zero baseline. */
101
+ baselineY(): number;
102
+ /** The center x-coordinate of category `c`. */
103
+ categoryCenterX(c: number): number;
104
+ /** Effective drawable width inside a category slot. */
105
+ private _innerWidth;
106
+ private _createBars;
107
+ /** The horizontal placement (center + width) of a bar. */
108
+ private _barPlacement;
109
+ /** The vertical placement (center + signed height) of a bar. */
110
+ private _barExtent;
111
+ private _createAxisLine;
112
+ private _createXLabels;
113
+ private _createYLabels;
114
+ private _createLegend;
115
+ /** The values as a defensive copy. */
116
+ getValues(): number[][];
117
+ /** The number of series. */
118
+ getNumSeries(): number;
119
+ /** The number of categories. */
120
+ getNumCategories(): number;
121
+ /** The chart mode. */
122
+ getMode(): BarChartMode;
123
+ /** The value range [min, max, step]. */
124
+ getYRange(): [number, number, number];
125
+ /** A single bar by series and category index. */
126
+ getBar(series: number, category: number): Rectangle | undefined;
127
+ /** All bars of one series as a VGroup. */
128
+ getSeries(series: number): VGroup;
129
+ copy(): StackedBarChart;
130
+ }
131
+ //# sourceMappingURL=StackedBarChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackedBarChart.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/StackedBarChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKlD,gEAAgE;AAChE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC,sFAAsF;IACtF,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,WAA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,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI/D,0CAA0C;IAC1C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAMxB,IAAI,IAAI,eAAe;CAsBjC"}
@@ -0,0 +1,90 @@
1
+ import { Group } from '../../core/Group';
2
+ import { VGroup } from '../../core/VGroup';
3
+ import { Polygon } from '../geometry/Polygon';
4
+ import { Axes } from './Axes';
5
+ /**
6
+ * Where the step between two points falls.
7
+ * - 'after': hold the current value, then jump at the next x (matplotlib 'post').
8
+ * - 'before': jump at the current x, then hold to the next x (matplotlib 'pre').
9
+ * - 'center': jump halfway between the two x-values (matplotlib 'mid').
10
+ */
11
+ export type StepMode = 'before' | 'after' | 'center';
12
+ /** Options for creating a StepChart. */
13
+ export interface StepChartOptions {
14
+ /** Y-values as [series][point]. A flat array is treated as a single series. */
15
+ values: number[][] | number[];
16
+ /** Shared x-values, one per point. Default: indices 0, 1, 2, ... */
17
+ xValues?: number[];
18
+ /** Where the step falls between points. Default: 'after' */
19
+ stepMode?: StepMode;
20
+ /** Series colors. Single color or array. Default: Manim palette */
21
+ seriesColors?: string | string[];
22
+ /** Stroke width for the step lines. Default: 3 */
23
+ lineWidth?: number;
24
+ /** Draw a dot at each data point. Default: false */
25
+ showDots?: boolean;
26
+ /** Dot radius when showDots is set. Default: 0.06 */
27
+ dotRadius?: number;
28
+ /** An existing Axes to plot onto. When omitted, one is built from the data. */
29
+ axes?: Axes;
30
+ /** X-axis range override as [min, max] or [min, max, step]. */
31
+ xRange?: [number, number] | [number, number, number];
32
+ /** Y-axis range override as [min, max] or [min, max, step]. */
33
+ yRange?: [number, number] | [number, number, number];
34
+ /** Visual length of the x-axis when auto-building axes. Default: 8 */
35
+ xLength?: number;
36
+ /** Visual length of the y-axis when auto-building axes. Default: 6 */
37
+ yLength?: number;
38
+ /** Color for the axes when auto-building. Default: white */
39
+ axisColor?: string;
40
+ }
41
+ /**
42
+ * StepChart - a line graph drawn as horizontal/vertical steps.
43
+ *
44
+ * Each series holds its value across an interval, then jumps to the next
45
+ * value. The jump falls before, after, or at the center of each interval,
46
+ * which suits discrete or state-over-time data.
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const chart = new StepChart({
51
+ * values: [0, 2, 2, 5, 3],
52
+ * stepMode: 'after',
53
+ * });
54
+ * ```
55
+ */
56
+ export declare class StepChart extends Group {
57
+ /** The coordinate system the steps are plotted on. */
58
+ axes: Axes;
59
+ /** The step lines, one per series. */
60
+ lines: VGroup;
61
+ /** The data-point dots, when enabled. */
62
+ dots: VGroup;
63
+ protected _values: number[][];
64
+ protected _x: number[];
65
+ protected _stepMode: StepMode;
66
+ protected _colors: string[];
67
+ protected _lineWidth: number;
68
+ protected _showDots: boolean;
69
+ protected _dotRadius: number;
70
+ /** Step vertices in data space, one array per series. */
71
+ protected _stepPoints: Array<Array<[number, number]>>;
72
+ constructor(options: StepChartOptions);
73
+ private _normalize;
74
+ /** Build the step vertices (data space) for one series. */
75
+ private _buildStepPoints;
76
+ private _buildAxes;
77
+ private _createLines;
78
+ /** The coordinate system. */
79
+ getAxes(): Axes;
80
+ /** The number of series. */
81
+ getNumSeries(): number;
82
+ /** The step line of series `s`. */
83
+ getLine(s: number): Polygon | undefined;
84
+ /** The step vertices in data space for series `s`. */
85
+ getStepPoints(s: number): Array<[number, number]>;
86
+ /** The step mode. */
87
+ getStepMode(): StepMode;
88
+ copy(): StepChart;
89
+ }
90
+ //# sourceMappingURL=StepChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepChart.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/StepChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE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