@amcharts/amcharts5 5.14.2 → 5.14.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.
- package/.internal/charts/gantt/GanttCategoryAxisRenderer.d.ts.map +1 -1
- package/.internal/charts/gantt/GanttCategoryAxisRenderer.js +6 -0
- package/.internal/charts/gantt/GanttCategoryAxisRenderer.js.map +1 -1
- package/.internal/charts/stock/drawing/DrawingSeries.d.ts +1 -0
- package/.internal/charts/stock/drawing/DrawingSeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/DrawingSeries.js +11 -0
- package/.internal/charts/stock/drawing/DrawingSeries.js.map +1 -1
- package/.internal/charts/stock/drawing/EllipseSeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/EllipseSeries.js +3 -0
- package/.internal/charts/stock/drawing/EllipseSeries.js.map +1 -1
- package/.internal/charts/stock/drawing/Measure.js +1 -1
- package/.internal/charts/stock/drawing/Measure.js.map +1 -1
- package/.internal/charts/stock/drawing/RectangleSeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/RectangleSeries.js +3 -0
- package/.internal/charts/stock/drawing/RectangleSeries.js.map +1 -1
- package/.internal/charts/xy/axes/Axis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/Axis.js +6 -2
- package/.internal/charts/xy/axes/Axis.js.map +1 -1
- package/.internal/charts/xy/axes/CategoryAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/CategoryAxis.js +1 -0
- package/.internal/charts/xy/axes/CategoryAxis.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/util/Color.js.map +1 -1
- package/.internal/core/util/Type.d.ts.map +1 -1
- package/.internal/core/util/Type.js +2 -1
- package/.internal/core/util/Type.js.map +1 -1
- package/CHANGELOG.md +12 -1
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gantt/package.json +1 -1
- package/examples/javascript/gantt-multilevel/package.json +1 -1
- package/examples/javascript/gantt-simple/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/javascript/timeline-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-spiral-chart/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gantt/package.json +1 -1
- package/examples/typescript/gantt-multilevel/package.json +1 -1
- package/examples/typescript/gantt-simple/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/typescript/timeline-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-spiral-chart/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../../../src/.internal/core/Registry.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,OAAO,QAAQ;IAArB;QACC;;WAEG;QACH;;;;mBAA2B,QAAQ;WAAC;QAEpC;;;WAGG;QACH;;;;mBAAqB,EAAE;WAAC;QAExB;;WAEG;QACH;;;;mBAAyC,EAAE;WAAC;QAE5C;;WAEG;QACH;;;;mBAAsB,EAAE;WAAC;IAE1B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACzC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAGD;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,IAAI,IAAI,CAAC;IACT,OAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;KACf;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACrC,IAAI,KAAK,CAAC;IACV,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE;YACtB,KAAK,GAAG,IAAI,CAAC;SACb;IACF,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["\r\n/**\r\n * @ignore\r\n */\r\nexport class Registry {\r\n\t/**\r\n\t * Currently running version of amCharts.\r\n\t */\r\n\treadonly version: string = \"5.14.
|
|
1
|
+
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../../../src/.internal/core/Registry.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,OAAO,QAAQ;IAArB;QACC;;WAEG;QACH;;;;mBAA2B,QAAQ;WAAC;QAEpC;;;WAGG;QACH;;;;mBAAqB,EAAE;WAAC;QAExB;;WAEG;QACH;;;;mBAAyC,EAAE;WAAC;QAE5C;;WAEG;QACH;;;;mBAAsB,EAAE;WAAC;IAE1B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACzC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAGD;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,IAAI,IAAI,CAAC;IACT,OAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;KACf;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACrC,IAAI,KAAK,CAAC;IACV,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE;YACtB,KAAK,GAAG,IAAI,CAAC;SACb;IACF,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["\r\n/**\r\n * @ignore\r\n */\r\nexport class Registry {\r\n\t/**\r\n\t * Currently running version of amCharts.\r\n\t */\r\n\treadonly version: string = \"5.14.3\";\r\n\r\n\t/**\r\n\t * List of applied licenses.\r\n\t * @ignore\r\n\t */\r\n\tlicenses: String[] = [];\r\n\r\n\t/**\r\n\t * Entities that have their `id` setting set.\r\n\t */\r\n\tentitiesById: { [index: string]: any } = {};\r\n\r\n\t/**\r\n\t * All created [[Root]] elements.\r\n\t */\r\n\trootElements: any[] = [];\r\n\r\n}\r\n\r\n/**\r\n\t* @ignore\r\n */\r\nexport const registry = new Registry();\r\n\r\n/**\r\n * Adds a license, e.g.:\r\n *\r\n * ```TypeScript\r\n * am5.addLicense(\"xxxxxxxx\");\r\n * ```\r\n * ```JavaScript\r\n * am5.addLicense(\"xxxxxxxx\");\r\n * ```\r\n *\r\n * Multiple licenses can be added to cover for multiple products.\r\n *\r\n * @param license License key\r\n */\r\nexport function addLicense(license: string): void {\r\n\tregistry.licenses.push(license);\r\n}\r\n\r\n\r\n/**\r\n * Disposes all [[Root]] elements.\r\n */\r\nexport function disposeAllRootElements(): void {\r\n\tlet root;\r\n\twhile(root = registry.rootElements.pop()) {\r\n\t\troot.dispose();\r\n\t}\r\n}\r\n\r\n/**\r\n * Finds and returns a `Root` element assigned to a container with `id`.\r\n * \r\n * @param id Container ID\r\n * @return Root\r\n * @since 5.9.2\r\n */\r\nexport function getRootById(id: string): any {\r\n\tlet found;\r\n\tregistry.rootElements.forEach((item) => {\r\n\t\tif (item.dom.id == id) {\r\n\t\t\tfound = item;\r\n\t\t}\r\n\t});\r\n\treturn found;\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Color.ts"],"names":[],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utils from \"./Utils\";\nimport * as $type from \"./Type\";\n\n/**\n * @ignore\n */\nfunction string2hex(string: string): number {\n\t//string = cssColorNames[string.toLowerCase()] || string;\n\n\tif (string[0] === \"#\") {\n\t\tstring = string.substr(1);\n\t}\n\tif (string.length == 3) {\n\t\tstring = string[0].repeat(2) + string[1].repeat(2) + string[2].repeat(2);\n\t}\n\n\treturn parseInt(string, 16);\n}\n\n/**\n * @ignore\n */\nexport function rgba2hex(color: string): number {\n\tcolor = color.replace(/[ ]/g, \"\");\n\n\t// Init\n\tlet matches: string[] | null = color.match(/^rgb\\(([0-9]*),([0-9]*),([0-9]*)\\)/i);\n\n\t// Try rgb() format\n\tif (matches) {\n\t\tmatches.push(\"1\");\n\n\t} else {\n\t\tmatches = color.match(/^rgba\\(([0-9]*),([0-9]*),([0-9]*),([.0-9]*)\\)/i);\n\n\t\tif (!matches) {\n\t\t\treturn 0x000000;\n\t\t}\n\t}\n\n\tlet hex = \"\";\n\tfor (let i = 1; i <= 3; i++) {\n\t\tlet val = parseInt(matches[i]).toString(16);\n\t\tif (val.length == 1) {\n\t\t\tval = \"0\" + val;\n\t\t}\n\t\thex += val;\n\t}\n\n\treturn string2hex(hex);\n\n}\n\n/**\n * Returns a new [[Color]] object base on input.\n *\n * Accepts parameters in CSS hex or rgb/rtba strings, or hex numbers.\n *\n * * `\"#f00\"`\n * * `\"#ff0000\"`\n * * `\"rgb(255, 0, 0)\"`\n * * `\"rgba(255, 0, 0, 1)\"`\n * * `0xff0000`\n * \n * @param input Input color\n * @return Color\n */\nexport function color(input: number | string): Color {\n\treturn Color.fromAny(input);\n}\n\n/**\n * Wherever color needs to be specified in amCharts 5, `Color` object needs to\n * be used.\n *\n * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/} for more info\n * @important\n */\nexport class Color {\n\tprotected _hex: number;\n\n\tprivate constructor(hex: number) {\n\t\tthis._hex = hex | 0;\n\t}\n\n\t/**\n\t * Color numeric value.\n\t */\n\tpublic get hex(): number {\n\t\treturn this._hex;\n\t}\n\n\t/**\n\t * Value of color's R channel.\n\t * @return R value\n\t */\n\tpublic get r(): number {\n\t\treturn this._hex >>> 16;\n\t}\n\n\t/**\n\t * Value of color's G channel.\n\t * @return G value\n\t */\n\tpublic get g(): number {\n\t\treturn (this._hex >> 8) & 0xFF;\n\t}\n\n\t/**\n\t * Value of color's B channel.\n\t * @return B value\n\t */\n\tpublic get b(): number {\n\t\treturn this._hex & 0xFF;\n\t}\n\n\t/**\n\t * Returns color CSS representation in form of `rgba(r, g, b, a)` string.\n\t * \n\t * @param alpha Opacity\n\t * @return CSS string\n\t */\n\tpublic toCSS(alpha: number = 1): string {\n\t\treturn \"rgba(\" + this.r + \", \" + this.g + \", \" + this.b + \", \" + alpha + \")\";\n\t}\n\n\t/**\n\t * Returns color CSS representation in form of `#rgb` string.\n\t * \n\t * @return CSS string\n\t */\n\tpublic toCSSHex(): string {\n\t\treturn \"#\" + $utils.padString(this.r.toString(16), 2) + $utils.padString(this.g.toString(16), 2) + $utils.padString(this.b.toString(16), 2);\n\t}\n\n\t/**\n\t * Returns color's HSL info.\n\t * @param alpha Opacity\n\t * @return HSL info\n\t */\n\tpublic toHSL(alpha: number = 1): $utils.iHSL {\n\t\treturn $utils.rgbToHsl({\n\t\t\tr: this.r,\n\t\t\tg: this.g,\n\t\t\tb: this.b,\n\t\t\ta: alpha\n\t\t})\n\t}\n\n\t/**\n\t * Converts HSL values into a new [[Color]] object.\n\t *\n\t * @param h H value\n\t * @param s S value\n\t * @param l L value\n\t * @return Color object\n\t */\n\tpublic static fromHSL(h: number, s: number, l: number): Color {\n\t\tconst rgb = $utils.hslToRgb({\n\t\t\th: h,\n\t\t\ts: s,\n\t\t\tl: l\n\t\t});\n\t\treturn this.fromRGB(rgb.r, rgb.g, rgb.b);\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.toCSSHex();\n\t}\n\n\t/**\n\t * Converts hex number into a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromHex(0xff0000) // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromHex(0xff0000) // red\n\t * ```\n\t *\n\t * @param hex Hex color\n\t * @return Color\n\t */\n\tpublic static fromHex(hex: number): Color {\n\t\treturn new Color(hex);\n\t}\n\n\t/**\n\t * Converts RGB values to a new [[Color]] object.\n\t *\n\t * @param r R value\n\t * @param g G value\n\t * @param b B value\n\t * @return Color\n\t */\n\tpublic static fromRGB(r: number, g: number, b: number): Color {\n\t\treturn new Color((b | 0) + (g << 8) + (r << 16));\n\t}\n\n\t/**\n\t * Converts RGB string to a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromString(\"#ff0000\") // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromString(\"#ff0000\") // red\n\t * ```\n\t *\n\t * @param s RGB string\n\t * @return Color\n\t */\n\tpublic static fromString(s: string): Color {\n\t\treturn new Color(string2hex(s));\n\t}\n\n\t/**\n\t * Converts CSS rgba() syntax to a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromCSS(\"rgba(255, 0, 0, 1)\") // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromCSS(\"rgba(255, 0, 0, 1)\") // red\n\t * ```\n\t *\n\t * @param {string} s [description]\n\t * @return {Color} [description]\n\t */\n\tpublic static fromCSS(s: string): Color {\n\t\treturn new Color(rgba2hex(s));\n\t}\n\n\t/**\n\t * Convert to color from virtually anything.\n\t *\n\t * Will throw an exception if unable to resolve the color.\n\t *\n\t * @param s Source\n\t * @return Color\n\t */\n\tpublic static fromAny(s: string | number | Color): Color {\n\t\tif ($type.isString(s)) {\n\t\t\tif (s[0] == \"#\") {\n\t\t\t\treturn Color.fromString(s);\n\t\t\t}\n\t\t\telse if (s.substr(0, 3) == \"rgb\") {\n\t\t\t\treturn Color.fromCSS(s);\n\t\t\t}\n\t\t}\n\t\telse if ($type.isNumber(s)) {\n\t\t\treturn Color.fromHex(s);\n\t\t}\n\t\telse if (s instanceof Color) {\n\t\t\treturn Color.fromHex(s.hex);\n\t\t}\n\n\t\tthrow new Error(\"Unknown color syntax: \" + s);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] object based on either `lightAlternative` or\n\t * `darkAlternative` depending on which one is more contrasting with\n\t * the `color`.\n\t *\n\t * @param color Reference color\n\t * @param lightAlternative Light color\n\t * @param darkAlternative Dark color\n\t * @return Alternative color\n\t */\n\tpublic static alternative(color: Color, lightAlternative?: Color, darkAlternative?: Color): Color {\n\t\tconst rgb = $utils.alternativeColor(\n\t\t\t{ r: color.r, g: color.g, b: color.b },\n\t\t\tlightAlternative ? { r: lightAlternative.r, g: lightAlternative.g, b: lightAlternative.b } : undefined,\n\t\t\tdarkAlternative ? { r: darkAlternative.r, g: darkAlternative.g, b: darkAlternative.b } : undefined\n\t\t);\n\t\treturn this.fromRGB(rgb.r, rgb.g, rgb.b);\n\t}\n\n\t/**\n\t * Returns an intermediate Color between two reference colors depending on\n\t * the progress (`diff`) between the two.\n\t *\n\t * @param diff Progress\n\t * @param from Source color\n\t * @param to Target color\n\t * @param mode Interpolation mode\n\t * @return Color\n\t */\n\tpublic static interpolate(diff: Time, from: Color, to: Color, mode: \"rgb\" | \"hsl\" = \"rgb\"): Color {\n\t\tif (mode == \"hsl\") {\n\t\t\tconst fromHSL = from.toHSL();\n\t\t\tconst toHSL = to.toHSL();\n\t\t\treturn Color.fromHSL(\n\t\t\t\trange(diff, fromHSL.h, toHSL.h),\n\t\t\t\trange(diff, fromHSL.s, toHSL.s),\n\t\t\t\trange(diff, fromHSL.l, toHSL.l)\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\treturn Color.fromRGB(\n\t\t\t\trange(diff, from.r, to.r),\n\t\t\t\trange(diff, from.g, to.g),\n\t\t\t\trange(diff, from.b, to.b)\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a new [[Color]] lightened by `percent` value.\n\t *\n\t * Use negative value to darken the color.\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static lighten(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.lighten({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] brightened by `percent` value.\n\t *\n\t * Use negative value to dim the color.\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static brighten(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.brighten({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] saturated by `percent` value.\n\t *\n\t * Value range is between `0` (fully desaturated), to `1` (full color).\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static saturate(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.saturate({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAQ,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAEhC;;GAEG;AACH,SAAS,UAAU,CAAC,MAAc;IACjC,yDAAyD;IAEzD,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACtB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC1B;IACD,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;QACvB,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,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AAe;QACnD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC,OAAO,CAAC,GAAI,CAAC,CAAC,EAAE,GAAI,CAAC,CAAC,EAAE,GAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,QAAQ,CAAC,KAAY,EAAE,OAAe;QACnD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC,OAAO,CAAC,GAAI,CAAC,CAAC,EAAE,GAAI,CAAC,CAAC,EAAE,GAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;CACD","sourcesContent":["import { range, Time } from \"./Animation\";\nimport * as $utils from \"./Utils\";\nimport * as $type from \"./Type\";\n\n/**\n * @ignore\n */\nfunction string2hex(string: string): number {\n\t//string = cssColorNames[string.toLowerCase()] || string;\n\n\tif (string[0] === \"#\") {\n\t\tstring = string.substr(1);\n\t}\n\tif (string.length == 3) {\n\t\tstring = string[0].repeat(2) + string[1].repeat(2) + string[2].repeat(2);\n\t}\n\n\treturn parseInt(string, 16);\n}\n\n/**\n * @ignore\n */\nexport function rgba2hex(color: string): number {\n\tcolor = color.replace(/[ ]/g, \"\");\n\n\t// Init\n\tlet matches: string[] | null = color.match(/^rgb\\(([0-9]*),([0-9]*),([0-9]*)\\)/i);\n\n\t// Try rgb() format\n\tif (matches) {\n\t\tmatches.push(\"1\");\n\n\t} else {\n\t\tmatches = color.match(/^rgba\\(([0-9]*),([0-9]*),([0-9]*),([.0-9]*)\\)/i);\n\n\t\tif (!matches) {\n\t\t\treturn 0x000000;\n\t\t}\n\t}\n\n\tlet hex = \"\";\n\tfor (let i = 1; i <= 3; i++) {\n\t\tlet val = parseInt(matches[i]).toString(16);\n\t\tif (val.length == 1) {\n\t\t\tval = \"0\" + val;\n\t\t}\n\t\thex += val;\n\t}\n\n\treturn string2hex(hex);\n\n}\n\n/**\n * Returns a new [[Color]] object base on input.\n *\n * Accepts parameters in CSS hex or rgb/rtba strings, or hex numbers.\n *\n * * `\"#f00\"`\n * * `\"#ff0000\"`\n * * `\"rgb(255, 0, 0)\"`\n * * `\"rgba(255, 0, 0, 1)\"`\n * * `0xff0000`\n *\n * @param input Input color\n * @return Color\n */\nexport function color(input: number | string): Color {\n\treturn Color.fromAny(input);\n}\n\n/**\n * Wherever color needs to be specified in amCharts 5, `Color` object needs to\n * be used.\n *\n * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/} for more info\n * @important\n */\nexport class Color {\n\tprotected _hex: number;\n\n\tprivate constructor(hex: number) {\n\t\tthis._hex = hex | 0;\n\t}\n\n\t/**\n\t * Color numeric value.\n\t */\n\tpublic get hex(): number {\n\t\treturn this._hex;\n\t}\n\n\t/**\n\t * Value of color's R channel.\n\t * @return R value\n\t */\n\tpublic get r(): number {\n\t\treturn this._hex >>> 16;\n\t}\n\n\t/**\n\t * Value of color's G channel.\n\t * @return G value\n\t */\n\tpublic get g(): number {\n\t\treturn (this._hex >> 8) & 0xFF;\n\t}\n\n\t/**\n\t * Value of color's B channel.\n\t * @return B value\n\t */\n\tpublic get b(): number {\n\t\treturn this._hex & 0xFF;\n\t}\n\n\t/**\n\t * Returns color CSS representation in form of `rgba(r, g, b, a)` string.\n\t *\n\t * @param alpha Opacity\n\t * @return CSS string\n\t */\n\tpublic toCSS(alpha: number = 1): string {\n\t\treturn \"rgba(\" + this.r + \", \" + this.g + \", \" + this.b + \", \" + alpha + \")\";\n\t}\n\n\t/**\n\t * Returns color CSS representation in form of `#rgb` string.\n\t *\n\t * @return CSS string\n\t */\n\tpublic toCSSHex(): string {\n\t\treturn \"#\" + $utils.padString(this.r.toString(16), 2) + $utils.padString(this.g.toString(16), 2) + $utils.padString(this.b.toString(16), 2);\n\t}\n\n\t/**\n\t * Returns color's HSL info.\n\t * @param alpha Opacity\n\t * @return HSL info\n\t */\n\tpublic toHSL(alpha: number = 1): $utils.iHSL {\n\t\treturn $utils.rgbToHsl({\n\t\t\tr: this.r,\n\t\t\tg: this.g,\n\t\t\tb: this.b,\n\t\t\ta: alpha\n\t\t})\n\t}\n\n\t/**\n\t * Converts HSL values into a new [[Color]] object.\n\t *\n\t * @param h H value\n\t * @param s S value\n\t * @param l L value\n\t * @return Color object\n\t */\n\tpublic static fromHSL(h: number, s: number, l: number): Color {\n\t\tconst rgb = $utils.hslToRgb({\n\t\t\th: h,\n\t\t\ts: s,\n\t\t\tl: l\n\t\t});\n\t\treturn this.fromRGB(rgb.r, rgb.g, rgb.b);\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.toCSSHex();\n\t}\n\n\t/**\n\t * Converts hex number into a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromHex(0xff0000) // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromHex(0xff0000) // red\n\t * ```\n\t *\n\t * @param hex Hex color\n\t * @return Color\n\t */\n\tpublic static fromHex(hex: number): Color {\n\t\treturn new Color(hex);\n\t}\n\n\t/**\n\t * Converts RGB values to a new [[Color]] object.\n\t *\n\t * @param r R value\n\t * @param g G value\n\t * @param b B value\n\t * @return Color\n\t */\n\tpublic static fromRGB(r: number, g: number, b: number): Color {\n\t\treturn new Color((b | 0) + (g << 8) + (r << 16));\n\t}\n\n\t/**\n\t * Converts RGB string to a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromString(\"#ff0000\") // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromString(\"#ff0000\") // red\n\t * ```\n\t *\n\t * @param s RGB string\n\t * @return Color\n\t */\n\tpublic static fromString(s: string): Color {\n\t\treturn new Color(string2hex(s));\n\t}\n\n\t/**\n\t * Converts CSS rgba() syntax to a new [[Color]] object.\n\t *\n\t * ```TypeScript\n\t * Color.fromCSS(\"rgba(255, 0, 0, 1)\") // red\n\t * ```\n\t * ```JavaScript\n\t * Color.fromCSS(\"rgba(255, 0, 0, 1)\") // red\n\t * ```\n\t *\n\t * @param {string} s [description]\n\t * @return {Color} [description]\n\t */\n\tpublic static fromCSS(s: string): Color {\n\t\treturn new Color(rgba2hex(s));\n\t}\n\n\t/**\n\t * Convert to color from virtually anything.\n\t *\n\t * Will throw an exception if unable to resolve the color.\n\t *\n\t * @param s Source\n\t * @return Color\n\t */\n\tpublic static fromAny(s: string | number | Color): Color {\n\t\tif ($type.isString(s)) {\n\t\t\tif (s[0] == \"#\") {\n\t\t\t\treturn Color.fromString(s);\n\t\t\t}\n\t\t\telse if (s.substr(0, 3) == \"rgb\") {\n\t\t\t\treturn Color.fromCSS(s);\n\t\t\t}\n\t\t}\n\t\telse if ($type.isNumber(s)) {\n\t\t\treturn Color.fromHex(s);\n\t\t}\n\t\telse if (s instanceof Color) {\n\t\t\treturn Color.fromHex(s.hex);\n\t\t}\n\n\t\tthrow new Error(\"Unknown color syntax: \" + s);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] object based on either `lightAlternative` or\n\t * `darkAlternative` depending on which one is more contrasting with\n\t * the `color`.\n\t *\n\t * @param color Reference color\n\t * @param lightAlternative Light color\n\t * @param darkAlternative Dark color\n\t * @return Alternative color\n\t */\n\tpublic static alternative(color: Color, lightAlternative?: Color, darkAlternative?: Color): Color {\n\t\tconst rgb = $utils.alternativeColor(\n\t\t\t{ r: color.r, g: color.g, b: color.b },\n\t\t\tlightAlternative ? { r: lightAlternative.r, g: lightAlternative.g, b: lightAlternative.b } : undefined,\n\t\t\tdarkAlternative ? { r: darkAlternative.r, g: darkAlternative.g, b: darkAlternative.b } : undefined\n\t\t);\n\t\treturn this.fromRGB(rgb.r, rgb.g, rgb.b);\n\t}\n\n\t/**\n\t * Returns an intermediate Color between two reference colors depending on\n\t * the progress (`diff`) between the two.\n\t *\n\t * @param diff Progress\n\t * @param from Source color\n\t * @param to Target color\n\t * @param mode Interpolation mode\n\t * @return Color\n\t */\n\tpublic static interpolate(diff: Time, from: Color, to: Color, mode: \"rgb\" | \"hsl\" = \"rgb\"): Color {\n\t\tif (mode == \"hsl\") {\n\t\t\tconst fromHSL = from.toHSL();\n\t\t\tconst toHSL = to.toHSL();\n\t\t\treturn Color.fromHSL(\n\t\t\t\trange(diff, fromHSL.h, toHSL.h),\n\t\t\t\trange(diff, fromHSL.s, toHSL.s),\n\t\t\t\trange(diff, fromHSL.l, toHSL.l)\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\treturn Color.fromRGB(\n\t\t\t\trange(diff, from.r, to.r),\n\t\t\t\trange(diff, from.g, to.g),\n\t\t\t\trange(diff, from.b, to.b)\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a new [[Color]] lightened by `percent` value.\n\t *\n\t * Use negative value to darken the color.\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static lighten(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.lighten({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] brightened by `percent` value.\n\t *\n\t * Use negative value to dim the color.\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static brighten(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.brighten({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n\n\t/**\n\t * Returns a new [[Color]] saturated by `percent` value.\n\t *\n\t * Value range is between `0` (fully desaturated), to `1` (full color).\n\t *\n\t * @param color Source color\n\t * @param percent Percent\n\t * @return New color\n\t */\n\tpublic static saturate(color: Color, percent: number): Color {\n\t\tconst rgb = $utils.saturate({ r: color.r, g: color.g, b: color.b }, percent);\n\t\treturn Color.fromRGB(rgb!.r, rgb!.g, rgb!.b);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Type.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH,aAAK,IAAI,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,IAAI,IAAI,SAAS,KAAK,GACpD,KAAK,GACL;KAAG,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEzB,aAAK,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAEhD;;GAEG;AACH,oBAAY,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAE9F;;GAEG;AACH,oBAAY,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAGrD;;;GAGG;AACH,oBAAY,MAAM,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAGjD;;GAEG;AACH,oBAAY,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAIhD;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,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,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAE3D;AAGD;;;;;GAKG;AAGH;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAkB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAmB,CAAC"}
|
|
@@ -55,7 +55,8 @@ export function toNumber(value) {
|
|
|
55
55
|
if (value != null && !isNumber(value)) {
|
|
56
56
|
let converted = Number(value);
|
|
57
57
|
if (isNaN(converted) && isString(value) && value != "" && value.match(/[0-9]+/)) {
|
|
58
|
-
|
|
58
|
+
const newValue = value.replace(/[^0-9.\-]+/g, '');
|
|
59
|
+
return value === newValue ? converted : toNumber(newValue);
|
|
59
60
|
}
|
|
60
61
|
return converted;
|
|
61
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AAChC,CAAC;AAaD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAI,KAAQ;IAClC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAS,CAAC;AAC1C,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,SAAkB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AU;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAGD;;;;;GAKG;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,UAAU,CAAC","sourcesContent":["/**\n * A collection of utility functions for various type checks and conversion\n * @hidden\n */\n\n/**\n * ============================================================================\n * IMPORTS\n * ============================================================================\n * @hidden\n */\n\n/**\n * ============================================================================\n * MISC\n * ============================================================================\n * @hidden\n */\n\ntype Cond<T, Keys extends keyof T> = Keys extends never\n\t? never\n\t: { [K in Keys]: T[K] };\n\ntype Never<T> = T extends undefined ? never : T;\n\n/**\n * Selects all the keys of T which have a value of U.\n */\nexport type SelectKeys<T, U> = Never<{ [K in keyof T]: T[K] extends U ? K : never }[keyof T]>;\n\n/**\n * Creates a new type which is the same as T except it only has the properties of type U.\n */\nexport type Select<T, U> = Cond<T, SelectKeys<T, U>>;\n\n\n/**\n * @todo Description\n * @ignore Exclude from docs\n */\nexport type Public<T> = { [P in keyof T]: T[P] };\n\n\n/**\n * `Keyof<T>` is the same as `keyof T` except it only accepts string keys, not numbers or symbols.\n */\nexport type Keyof<T> = Extract<keyof T, string>;\n\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Returns `true` if value is not a number (NaN).\n *\n * @param value Input value\n * @return Is NaN?\n */\nexport function isNaN(value: number): boolean {\n\treturn Number(value) !== value;\n}\n\n/**\n * Represents a type for all available JavaScript variable types.\n */\nexport type Type\n\t= \"[object Object]\"\n\t| \"[object Array]\"\n\t| \"[object String]\"\n\t| \"[object Number]\"\n\t| \"[object Boolean]\"\n\t| \"[object Date]\";\n\n/**\n * Returns a type of the value.\n *\n * @param value Input value\n * @return Type of the value\n * @ignore\n */\nexport function getType<A>(value: A): Type {\n\treturn ({}).toString.call(value) as Type;\n}\n\n\n/**\n * Asserts that the condition is true.\n *\n * @param condition Condition to check\n * @param message Message to display in the error\n * @ignore\n */\nexport function assert(condition: boolean, message: string = \"Assertion failed\"): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message);\n\t}\n}\n\n\n/**\n * ============================================================================\n * QUICK CONVERSION\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * Converts any value into a `number`.\n *\n * @param value Source value\n * @return Number representation of value\n */\nexport function toNumber(value: any): number {\n\tif (value != null && !isNumber(value)) {\n\t\tlet converted = Number(value);\n\t\tif (isNaN(converted) && isString(value) && value != \"\" && value.match(/[0-9]+/)) {\n\t\t\treturn toNumber(value.replace(/[^0-9.\\-]+/g, ''));\n\t\t}\n\t\treturn converted;\n\t}\n\treturn value;\n}\n\n\n\n/**\n * Converts anything to Date object.\n *\n * @param value A value of any type\n * @return Date object representing a value\n */\nexport function toDate(value: Date | number | string): Date {\n\tif (isDate(value)) {\n\t\t// TODO maybe don't create a new Date ?\n\t\treturn new Date(value);\n\t}\n\n\telse if (isNumber(value)) {\n\t\treturn new Date(value);\n\t}\n\n\telse {\n\t\t// Try converting to number (assuming timestamp)\n\t\tlet num = Number(value);\n\n\t\tif (!isNumber(num)) {\n\t\t\treturn new Date(value);\n\t\t}\n\t\telse {\n\t\t\treturn new Date(num);\n\t\t}\n\t}\n}\n\n/**\n * Converts numeric value into string. Deals with large or small numbers that\n * would otherwise use exponents.\n *\n * @param value Numeric value\n * @return Numeric value as string\n */\nexport function numberToString(value: number): string {\n\t// TODO handle Infinity and -Infinity\n\tif (isNaN(value)) {\n\t\treturn \"NaN\";\n\t}\n\n\tif (value === Infinity) {\n\t\treturn \"Infinity\";\n\t}\n\n\tif (value === -Infinity) {\n\t\treturn \"-Infinity\";\n\t}\n\n\t// Negative 0\n\tif ((value === 0) && (1 / value === -Infinity)) {\n\t\treturn \"-0\";\n\t}\n\n\t// Preserve negative and deal with absoute values\n\tlet negative = value < 0;\n\n\tvalue = Math.abs(value);\n\n\t// TODO test this\n\tlet parsed = /^([0-9]+)(?:\\.([0-9]+))?(?:e[\\+\\-]([0-9]+))?$/.exec(\"\" + value)!;\n\tlet digits = parsed[1];\n\tlet decimals = parsed[2] || \"\";\n\n\tlet res: string;\n\n\t// Leave the nummber as it is if it does not use exponents\n\tif (parsed[3] === undefined) {\n\t\tres = (decimals === \"\" ? digits : digits + \".\" + decimals);\n\n\t} else {\n\t\tlet exponent = +parsed[3];\n\n\t\t// Deal with decimals\n\t\tif (value < 1) {\n\t\t\tlet zeros = exponent - 1;\n\n\t\t\tres = \"0.\" + repeat(\"0\", zeros) + digits + decimals;\n\n\t\t\t// Deal with integers\n\t\t} else {\n\t\t\tlet zeros = exponent - decimals.length;\n\n\t\t\tif (zeros === 0) {\n\t\t\t\tres = digits + decimals;\n\n\t\t\t} else if (zeros < 0) {\n\t\t\t\tres = digits + decimals.slice(0, zeros) + \".\" + decimals.slice(zeros);\n\n\t\t\t} else {\n\t\t\t\tres = digits + decimals + repeat(\"0\", zeros);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn negative ? \"-\" + res : res;\n}\n\n/**\n * Repeats a `string` number of times as set in `amount`.\n *\n * @ignore Exclude from docs\n * @todo Make this faster\n * @param string Source string\n * @param amount Number of times to repeat string\n * @return New string\n */\nexport function repeat(string: string, amount: number): string {\n return new Array(amount + 1).join(string);\n}\n\n\n/**\n * ============================================================================\n * VALUE PRESENCE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Defines an optional value that can be of any type or `undefined`.\n */\nexport type Optional<A> = A | undefined;\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Checks if parameter is `Date`.\n *\n * @param value Input value\n * @return Is Date?\n */\nexport function isDate(value: any): value is Date {\n\treturn getType(value) === \"[object Date]\";\n}\n\n/**\n * Checks if parameter is `string`.\n *\n * @param value Input value\n * @return Is string?\n */\nexport function isString(value: any): value is string {\n\treturn typeof value === \"string\";\n}\n\n/**\n * Checks if parameter is `number`.\n *\n * @param value Input value\n * @return Is number?\n */\nexport function isNumber(value: any): value is number {\n\treturn typeof value === \"number\" && Number(value) == value;\n}\n\n/**\n * Checks if parameter is `object`.\n *\n * @param value Input value\n * @return Is object?\n */\nexport function isObject(value: any): value is object {\n\treturn typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if parameter is `Array`.\n *\n * @param value Input value\n * @return Is Array?\n */\nexport function isArray(value: any): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\n\n/**\n * ============================================================================\n * STATIC CONSTANTS\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER: string = \"__§§§__\";\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER2: string = \"__§§§§__\";\n"]}
|
|
1
|
+
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AAChC,CAAC;AAaD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAI,KAAQ;IAClC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAS,CAAC;AAC1C,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,SAAkB,EAAE,UAAkB,kBAAkB;IAC9E,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC;AAGD;;;;;GAKG;AAGH;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU;IAClC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACtC,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;Q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ent":["/**\n * A collection of utility functions for various type checks and conversion\n * @hidden\n */\n\n/**\n * ============================================================================\n * IMPORTS\n * ============================================================================\n * @hidden\n */\n\n/**\n * ============================================================================\n * MISC\n * ============================================================================\n * @hidden\n */\n\ntype Cond<T, Keys extends keyof T> = Keys extends never\n\t? never\n\t: { [K in Keys]: T[K] };\n\ntype Never<T> = T extends undefined ? never : T;\n\n/**\n * Selects all the keys of T which have a value of U.\n */\nexport type SelectKeys<T, U> = Never<{ [K in keyof T]: T[K] extends U ? K : never }[keyof T]>;\n\n/**\n * Creates a new type which is the same as T except it only has the properties of type U.\n */\nexport type Select<T, U> = Cond<T, SelectKeys<T, U>>;\n\n\n/**\n * @todo Description\n * @ignore Exclude from docs\n */\nexport type Public<T> = { [P in keyof T]: T[P] };\n\n\n/**\n * `Keyof<T>` is the same as `keyof T` except it only accepts string keys, not numbers or symbols.\n */\nexport type Keyof<T> = Extract<keyof T, string>;\n\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Returns `true` if value is not a number (NaN).\n *\n * @param value Input value\n * @return Is NaN?\n */\nexport function isNaN(value: number): boolean {\n\treturn Number(value) !== value;\n}\n\n/**\n * Represents a type for all available JavaScript variable types.\n */\nexport type Type\n\t= \"[object Object]\"\n\t| \"[object Array]\"\n\t| \"[object String]\"\n\t| \"[object Number]\"\n\t| \"[object Boolean]\"\n\t| \"[object Date]\";\n\n/**\n * Returns a type of the value.\n *\n * @param value Input value\n * @return Type of the value\n * @ignore\n */\nexport function getType<A>(value: A): Type {\n\treturn ({}).toString.call(value) as Type;\n}\n\n\n/**\n * Asserts that the condition is true.\n *\n * @param condition Condition to check\n * @param message Message to display in the error\n * @ignore\n */\nexport function assert(condition: boolean, message: string = \"Assertion failed\"): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message);\n\t}\n}\n\n\n/**\n * ============================================================================\n * QUICK CONVERSION\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * Converts any value into a `number`.\n *\n * @param value Source value\n * @return Number representation of value\n */\nexport function toNumber(value: any): number {\n\tif (value != null && !isNumber(value)) {\n\t\tlet converted = Number(value);\n\t\tif (isNaN(converted) && isString(value) && value != \"\" && value.match(/[0-9]+/)) {\n\t\t\tconst newValue = value.replace(/[^0-9.\\-]+/g, '');\n\t\t\treturn value === newValue ? converted : toNumber(newValue);\n\t\t}\n\t\treturn converted;\n\t}\n\treturn value;\n}\n\n\n\n/**\n * Converts anything to Date object.\n *\n * @param value A value of any type\n * @return Date object representing a value\n */\nexport function toDate(value: Date | number | string): Date {\n\tif (isDate(value)) {\n\t\t// TODO maybe don't create a new Date ?\n\t\treturn new Date(value);\n\t}\n\n\telse if (isNumber(value)) {\n\t\treturn new Date(value);\n\t}\n\n\telse {\n\t\t// Try converting to number (assuming timestamp)\n\t\tlet num = Number(value);\n\n\t\tif (!isNumber(num)) {\n\t\t\treturn new Date(value);\n\t\t}\n\t\telse {\n\t\t\treturn new Date(num);\n\t\t}\n\t}\n}\n\n/**\n * Converts numeric value into string. Deals with large or small numbers that\n * would otherwise use exponents.\n *\n * @param value Numeric value\n * @return Numeric value as string\n */\nexport function numberToString(value: number): string {\n\t// TODO handle Infinity and -Infinity\n\tif (isNaN(value)) {\n\t\treturn \"NaN\";\n\t}\n\n\tif (value === Infinity) {\n\t\treturn \"Infinity\";\n\t}\n\n\tif (value === -Infinity) {\n\t\treturn \"-Infinity\";\n\t}\n\n\t// Negative 0\n\tif ((value === 0) && (1 / value === -Infinity)) {\n\t\treturn \"-0\";\n\t}\n\n\t// Preserve negative and deal with absoute values\n\tlet negative = value < 0;\n\n\tvalue = Math.abs(value);\n\n\t// TODO test this\n\tlet parsed = /^([0-9]+)(?:\\.([0-9]+))?(?:e[\\+\\-]([0-9]+))?$/.exec(\"\" + value)!;\n\tlet digits = parsed[1];\n\tlet decimals = parsed[2] || \"\";\n\n\tlet res: string;\n\n\t// Leave the nummber as it is if it does not use exponents\n\tif (parsed[3] === undefined) {\n\t\tres = (decimals === \"\" ? digits : digits + \".\" + decimals);\n\n\t} else {\n\t\tlet exponent = +parsed[3];\n\n\t\t// Deal with decimals\n\t\tif (value < 1) {\n\t\t\tlet zeros = exponent - 1;\n\n\t\t\tres = \"0.\" + repeat(\"0\", zeros) + digits + decimals;\n\n\t\t\t// Deal with integers\n\t\t} else {\n\t\t\tlet zeros = exponent - decimals.length;\n\n\t\t\tif (zeros === 0) {\n\t\t\t\tres = digits + decimals;\n\n\t\t\t} else if (zeros < 0) {\n\t\t\t\tres = digits + decimals.slice(0, zeros) + \".\" + decimals.slice(zeros);\n\n\t\t\t} else {\n\t\t\t\tres = digits + decimals + repeat(\"0\", zeros);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn negative ? \"-\" + res : res;\n}\n\n/**\n * Repeats a `string` number of times as set in `amount`.\n *\n * @ignore Exclude from docs\n * @todo Make this faster\n * @param string Source string\n * @param amount Number of times to repeat string\n * @return New string\n */\nexport function repeat(string: string, amount: number): string {\n return new Array(amount + 1).join(string);\n}\n\n\n/**\n * ============================================================================\n * VALUE PRESENCE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Defines an optional value that can be of any type or `undefined`.\n */\nexport type Optional<A> = A | undefined;\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Checks if parameter is `Date`.\n *\n * @param value Input value\n * @return Is Date?\n */\nexport function isDate(value: any): value is Date {\n\treturn getType(value) === \"[object Date]\";\n}\n\n/**\n * Checks if parameter is `string`.\n *\n * @param value Input value\n * @return Is string?\n */\nexport function isString(value: any): value is string {\n\treturn typeof value === \"string\";\n}\n\n/**\n * Checks if parameter is `number`.\n *\n * @param value Input value\n * @return Is number?\n */\nexport function isNumber(value: any): value is number {\n\treturn typeof value === \"number\" && Number(value) == value;\n}\n\n/**\n * Checks if parameter is `object`.\n *\n * @param value Input value\n * @return Is object?\n */\nexport function isObject(value: any): value is object {\n\treturn typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if parameter is `Array`.\n *\n * @param value Input value\n * @return Is Array?\n */\nexport function isArray(value: any): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\n\n/**\n * ============================================================================\n * STATIC CONSTANTS\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER: string = \"__§§§__\";\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER2: string = \"__§§§§__\";\n"]}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
|
5
5
|
Please note, that this project, while following numbering syntax, it DOES NOT
|
|
6
6
|
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
7
7
|
|
|
8
|
+
## [5.14.3] - 2025-10-13
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- If an axis range was created on `CategoryAxis` and then data was changed which wouldn't have these categories anymore, elements of the axis range remained visible on the chart.
|
|
12
|
+
- Hovering over `Gantt` category labels caused background of the category item to unhover.
|
|
13
|
+
- `am5.type.toNumber()` function would go into dead loop if the parameter contained multiple dots or minus symbols.
|
|
14
|
+
- Stock chart's drawings were snapped to initial position if data update happened while dragging the drawing.
|
|
15
|
+
- Measure drawing tool in `StockChart` had colors inverted (red for positive, green for negative).
|
|
16
|
+
- Zooming an `XYChart` with mouse wheel really fast could result chart to be zoomed to a state where user could not zoom-out anymore.
|
|
17
|
+
|
|
18
|
+
|
|
8
19
|
## [5.14.2] - 2025-10-01
|
|
9
20
|
|
|
10
21
|
### Changed
|
|
@@ -114,7 +125,7 @@ adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
|
114
125
|
|
|
115
126
|
## [5.13.0] - 2025-06-05
|
|
116
127
|
|
|
117
|
-
### Added
|
|
128
|
+
### Added
|
|
118
129
|
- `exactLocationX` and `exactLocationY` added to `XYSeries`. If this is set to `true`, data items will ignore `locationX`/`locationY` setting but will place the data point at exact X/Y value. This will work only with `DateAxis`. If used on a `ColumnSeries`/`CandlestickSeries` it will affect its bullets only.
|
|
119
130
|
- `autoHidePanelControls` added to `StockChart`.
|
|
120
131
|
- `containStroke` added to `Rectangle`. If this is set to `true`, rectangle will be drawn in such a way that its stroke is contained within the rectangle's width and height. Useful if you have thicker `strokeWidth` for `ColumnSeries`.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "amcharts5-example-map-animating-along-lines",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@amcharts/amcharts5": "^5.14.
|
|
6
|
+
"@amcharts/amcharts5": "^5.14.3",
|
|
7
7
|
"@amcharts/amcharts5-geodata": "^5.1.5",
|
|
8
8
|
"source-map-loader": "^4.0.1",
|
|
9
9
|
"webpack": "^5.1.3",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "amcharts5-example-map-globe-rotate-to-country",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@amcharts/amcharts5": "^5.14.
|
|
6
|
+
"@amcharts/amcharts5": "^5.14.3",
|
|
7
7
|
"@amcharts/amcharts5-geodata": "^5.1.5",
|
|
8
8
|
"source-map-loader": "^4.0.1",
|
|
9
9
|
"webpack": "^5.1.3",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "amcharts5-example-map-globe-with-projected-circles",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@amcharts/amcharts5": "^5.14.
|
|
6
|
+
"@amcharts/amcharts5": "^5.14.3",
|
|
7
7
|
"@amcharts/amcharts5-geodata": "^5.1.5",
|
|
8
8
|
"source-map-loader": "^4.0.1",
|
|
9
9
|
"webpack": "^5.1.3",
|