diff --git a/apis/interfaces/chain.js b/apis/interfaces/chain.js new file mode 100644 index 0000000..cd75ebe --- /dev/null +++ b/apis/interfaces/chain.js @@ -0,0 +1,44 @@ + +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + * moduleName: 区块链 + */ + +import { request } from '../index' + +// 最新区块列表 +const chain = () => { + return request({ + url: 'chain' + }) +} + +// 发行量概况 +const situation = () => { + return request({ + url: 'nodes' + }) +} + +// 区块详情 +const hash = (hash) => { + return request({ + url: 'chain/block/' + hash + }) +} + +// 区块链首页 +const occ = () => { + return request({ + url: 'occ/index' + }) +} + +export { + chain, + situation, + hash, + occ +} diff --git a/apis/interfaces/crystal.js b/apis/interfaces/crystal.js new file mode 100644 index 0000000..96f97f6 --- /dev/null +++ b/apis/interfaces/crystal.js @@ -0,0 +1,63 @@ + +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + * moduleName: 矿机 + */ + +import { request } from '../index' + +// 水晶原石 +const crystals = () => { + return request({ + url: 'user/account/crystals' + }) +} + +// 领取水晶 +const thawlog = (data) => { + return request({ + url: 'user/account/thawlog', + method: 'POST', + data + }) +} + +// 水晶分类 +const category = () => { + return request({ + url: 'crystal/category' + }) +} + +// 水晶任务 +const task = () => { + return request({ + url: 'crystal/task' + }) +} + +// 水晶用户签到-信息 +const sign = () => { + return request({ + url: 'user/sign' + }) +} + +// 水晶用户签到 +const operateSign = () => { + return request({ + url: 'user/sign', + method: 'POST' + }) +} + +export{ + crystals, + thawlog, + category, + task, + sign, + operateSign +} diff --git a/apis/interfaces/index.js b/apis/interfaces/index.js new file mode 100644 index 0000000..8343eea --- /dev/null +++ b/apis/interfaces/index.js @@ -0,0 +1,123 @@ +/** + * Web-zdx + * moduleName: 商城首页 + */ + +import { request } from '../index' + +// 首页信息 +const index = () => { + return request({ + url: 'mall', + method: 'GET' + }) +} +// 今日特惠页面 (大于三显示3个 两个显示两个 1个就显示一张图) +const indexT = (data) => { + return request({ + url: 'mall/goods', + method: 'GET', + data:data + }) +} +// 获取首页弹窗 +const popups = () => { + return request({ + url: 'popups/mall', + method: 'GET' + }) +} +const banner = () => { + return request({ + url: 'mall/banners', + method: 'GET' + }) +} + +// 全养头条 +const cmsArticles = () => { + return request({ + url: 'cms/articles', + method: 'GET' + }) +} + +// 全养头条详情 +const cmsArticlesDetail = (id) => { + return request({ + url: 'cms/articles/'+id, + method: 'GET' + }) +} + +// 获取是否有未读消息 +const notifyCounts = () => { + return request({ + url: 'notifications/counts', + method: 'GET' + }) +} + +// 判断是否能跳转到钱包页面 +const canGoWallet = () => { + return request({ + url: 'user/datas', + method: 'GET' + }) +} + +// 是否设置了激活激活钱包 +const security = () => { + return request({ + url: 'chain/safe/security', + method: 'GET' + }) +} + +// 是否个人认证成功 +const certified = () => { + return request({ + url: 'user/certified', + method: 'GET' + }) +} + +// 获取首页商品列表 taos ='淘宝客' goods/mall (自己商品) +const getIndexGoodsList = (name,data) => { + return request({ + url: name, + method: 'GET', + data:data + }) +} +// 获取淘宝客的标签 +const getTaoCategories = () =>{ + return request({ + url: 'tao/categories', + method: 'GET' + }) +} +// 获取自营的标签 +const getTags = () =>{ + return request({ + url: 'mall/tags', + method: 'GET' + }) +} + + +export { + index, + cmsArticles, + notifyCounts, + cmsArticlesDetail, + canGoWallet, + security, + certified, + getIndexGoodsList, + getTaoCategories, + getTags, + banner, + popups, + indexT +} diff --git a/pages/found/index.vue b/pages/found/index.vue index 49a5696..9d93727 100644 --- a/pages/found/index.vue +++ b/pages/found/index.vue @@ -1,17 +1,549 @@ + + &::before { + position: absolute; + top: 0; + bottom: 0; + content: ""; + width: 2rpx; + left: 50%; + background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .7), transparent); + } + } + // 矿石 + .ore { + position: relative; + &>image { + width: 100%; + } + .ore-lists { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + .oct-float-item{ + position: absolute; + text-align: center; + .text { + margin-top: $margin / 2; + color: white; + font-size: $title-size-sm; + line-height: 40rpx; + text-shadow: 0 3rpx 3rpx rgba($color: #000000, $alpha: .2); + } + .icon { + width: 58rpx; + vertical-align: top; + } + } + .ore-item-nav{ + @extend .oct-float-item; + right: $margin * 3; + top: 12%; + } + .ore-item { + @extend .oct-float-item; + &:nth-child(1) { top: 16%; left: 13%; } + &:nth-child(2) { top: 50%; right: 10%; } + &:nth-child(3) { top: 23%; right: 20%; } + &:nth-child(4) { top: 70%; left: 33%;} + &:nth-child(5) { top: 40%; left: 20%; } + &:nth-child(6) { top: 58%; left: 10%;} + &:nth-child(7) { top: 10%; right: 43%;} + &:nth-child(8) { top: 46%; right: 29%;} + } + } + } + // 任务 + .task-block { + white-space: nowrap; + .item { + background: rgba($color: $mian-color, $alpha: .2); + display: inline-block; + margin-left: $margin; + width: 210rpx; + padding: $padding * 2 $padding; + border-radius: $radius; + box-sizing: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .06); + text-align: center; + &:first-child { + margin-left: $margin + $margin/2; + } + &:last-child { + margin-right: $margin + $margin/2; + } + .icon { + display: inline-block; + margin: $margin 0; + width: 98rpx; + height: 98rpx; + line-height: 98rpx; + background: $mian-color-deep; + border-radius: 50%; + text-align: center; + image { + width: 56rpx; + height: 56rpx; + vertical-align: middle; + } + } + .text { + font-size: $title-size-m; + color: $mian-color; + } + .title { + font-size: $title-size; + color: white; + font-weight: bold; + } + } + } + diff --git a/pages/index/index.vue b/pages/index/index.vue index 2bc0811..41cadb8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,19 +1,484 @@ - + + diff --git a/scss/globa.scss b/scss/globa.scss index 5092a9b..2876f60 100644 --- a/scss/globa.scss +++ b/scss/globa.scss @@ -10,6 +10,8 @@ $text-color: #333; $text-gray: #555; $text-gray-m: #999; $text-price: #8b64fd; +$mian-color: #8b64fd; +$mian-color-deep: #824f9a; // 边框颜色 $border-color: #ddd; @@ -23,6 +25,7 @@ $title-size-sm: 26rpx; // 模块圆角 $radius: 20rpx; +$radius-sm: 10rpx; // 模块边距 $margin: 30rpx; diff --git a/static/background/chain-back-00.png b/static/background/chain-back-00.png new file mode 100644 index 0000000..b314449 Binary files /dev/null and b/static/background/chain-back-00.png differ diff --git a/static/background/chain-back-01.png b/static/background/chain-back-01.png new file mode 100644 index 0000000..fdd32cf Binary files /dev/null and b/static/background/chain-back-01.png differ diff --git a/static/background/chain-back-02.png b/static/background/chain-back-02.png new file mode 100644 index 0000000..ba604f4 Binary files /dev/null and b/static/background/chain-back-02.png differ diff --git a/static/background/crystal-background.png b/static/background/crystal-background.png new file mode 100644 index 0000000..dcbf609 Binary files /dev/null and b/static/background/crystal-background.png differ diff --git a/static/background/idcard-positive.png b/static/background/idcard-positive.png new file mode 100644 index 0000000..bb22c71 Binary files /dev/null and b/static/background/idcard-positive.png differ diff --git a/static/background/idcard-reverse.png b/static/background/idcard-reverse.png new file mode 100644 index 0000000..f88a834 Binary files /dev/null and b/static/background/idcard-reverse.png differ diff --git a/static/background/wallet-back.png b/static/background/wallet-back.png new file mode 100644 index 0000000..5470f61 Binary files /dev/null and b/static/background/wallet-back.png differ diff --git a/static/background/wallet-code-background.png b/static/background/wallet-code-background.png new file mode 100644 index 0000000..c5c0627 Binary files /dev/null and b/static/background/wallet-code-background.png differ diff --git a/static/icons/crystal-icon.png b/static/icons/crystal-icon.png new file mode 100644 index 0000000..4c1ab9c Binary files /dev/null and b/static/icons/crystal-icon.png differ diff --git a/static/icons/gemstone-icon.png b/static/icons/gemstone-icon.png new file mode 100644 index 0000000..39db38f Binary files /dev/null and b/static/icons/gemstone-icon.png differ diff --git a/static/imgs/crystal-sign.png b/static/imgs/crystal-sign.png new file mode 100644 index 0000000..b9fd786 Binary files /dev/null and b/static/imgs/crystal-sign.png differ diff --git a/static/imgs/user-crystalMark-grey.png b/static/imgs/user-crystalMark-grey.png new file mode 100644 index 0000000..567daeb Binary files /dev/null and b/static/imgs/user-crystalMark-grey.png differ diff --git a/uni_modules/lime-f2/changelog.md b/uni_modules/lime-f2/changelog.md new file mode 100644 index 0000000..f565cda --- /dev/null +++ b/uni_modules/lime-f2/changelog.md @@ -0,0 +1,149 @@ +## 0.5.1(2021-05-14) +- feat: props 增加 `isDisableScroll` ,触摸图表时是否禁止页面滚动 +- feat: props 增加 `webviewStyles` ,webview 的样式, 仅nvue有效 +## 0.5.0(2021-05-13) +- docs: 插件用到了css 预编译器 [stylus](https://ext.dcloud.net.cn/plugin?name=compile-stylus) 请安装它 +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.9(2021-05-12) +- fix: 修复 百度平台 多个图表时 只生效一个的bug +## 0.4.8(2021-05-10) +- feat: 增加 `destroy` 方法,用于销毁实例 +- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片 +```js +this.$refs.chart.canvasToTempFilePath({success: res => { + console.log('tempFilePath:', res.tempFilePath) +}}) +``` +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) + +## 0.4.7(2021-05-10) +- chore: F2 版本更新至 3.8.7 +## 0.4.6(2021-05-05) +- docs: nvue 使用文档更新 +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.5.7(2021-04-30) +- chore: nvue 增强 支持 console.log 输出到控制台方便调试 +- docs: nvue 使用文档更新,不再需要声明F2 +## 0.4.5.6(2021-04-29) +- fix: nvue 修复打包后 函数字符串被压缩无效的问题 +- 若发现打包依然无效可使用直接返回字符串 +```js +this.$refs.chart.init(config => { + return ` + const chart = new F2.Chart(config); + chart.source(data); + chart + .interval() + .position('genre*sold') + .color('genre'); + chart.render(); + return chart; + ` +},{data}); +``` +- chore: 新增支持词云能力,头条小程序需要1.78.0后 +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.5.5(2021-04-25) +- fix: 修复新版谷歌浏览器(90.0.4430.85) 报 `transform ` 的问题 +## 0.4.5.4(2021-04-23) +- fix: 修复支付宝小程序尺寸问题 +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.5.3(2021-04-22) +- chore: 删除多余console.log +## 0.4.5.2(2021-04-21) +- chore: 修复字节颜色报错的问题。 +## 0.4.5.1(2021-04-18) +- chore: 增加默认尺寸 **300 x 300** , 当父级没有尺寸时启用。 +- 由于 F2 **云图** 依赖的 `@antv/data-set` 只支持H5创建Canvas,所以暂时只有 H5 支持。 +- 由于 F2 对绘制地图 不佳,故地图示例南海诸岛使用图片。 +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.5(2021-04-16) +- fix: 修复 app-vue 字体固定问题 +- fix: 修复 h5 app-vue 画多边形尺寸过大 +- fix: 修复 初始化 func 问题 +- docs: 增加 矩形式树图 示例 +- 由于 F2 **云图** 依赖的 `@antv/data-set` 只支持H5创建Canvas,所以暂时只有 H5 支持。 +## 0.4.4.1(2021-04-16) +- chore: 更改 `webview` 地址 +## 0.4.4(2021-04-16) +- chore: `nvue` 增加 chart.$emit 事件,主要用于图表交互,接收动作事件数据。 +```html + +``` +```js +chart.tooltip({ + onChange: (ev) => { + chart.$emit('change', ev) + } +}) +``` +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.3.1(2021-04-14) +- docs: 更新官网上的代码示例!复制粘贴即用 +## [代码示例 http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) +## 0.4.3(2021-04-13) +- chore: 增加`onInit`的属性函数,直接向图表传递初始化函数 +```html + +``` +```js +export default { + data: ()=>({ + onInitChart: config => { + const chart = new F2.Chart(config); + const data = [ + { value: 63.4, city: 'New York', date: '2011-10-01' }, + { value: 62.7, city: 'Alaska', date: '2011-10-01' }, + { value: 72.2, city: 'Austin', date: '2011-10-01' }, + { value: 58, city: 'New York', date: '2011-10-02' }, + { value: 59.9, city: 'Alaska', date: '2011-10-02' }, + { value: 67.7, city: 'Austin', date: '2011-10-02' }, + { value: 53.3, city: 'New York', date: '2011-10-03' }, + { value: 59.1, city: 'Alaska', date: '2011-10-03' }, + { value: 69.4, city: 'Austin', date: '2011-10-03' }, + ]; + chart.source(data, { + date: { + range: [0, 1], + type: 'timeCat', + mask: 'MM-DD' + }, + value: { + max: 300, + tickCount: 4 + } + }); + chart.area().position('date*value').color('city').adjust('stack'); + chart.line().position('date*value').color('city').adjust('stack'); + chart.render(); + // 注意:需要把chart return 出来 + return chart; + } + }) +} +``` +## 0.4.2(2021-04-09) +- chore: `nvue` webview 改为网络地址 +## 0.4.1(2021-04-09) +- chore: `redraw(callback)` 更名为 `reset(callback)` +- fix: 修复 `nvue` 某些情况下无法传递函数字符串 +- feat: 增加 `nvue` 下使用 `insertCss` 给节点设置 style +## 0.4.0(2021-04-08) +- chore: antv F2 version 更新到 `3.8.6` +- feat: `f2-all`,`f2-simple`等文件,默认只提供`f2.min.js`,如果需要`f2-all`或`f2-simple`可去码云下载按自已需要引入! +- fix: 修复钉钉小程序measureText undefined的问题 +- fix: 修复小程序因`hammer`引用报错 +## 0.3.0(2021-04-06) +- feat: `redraw(callback)` 方法重绘 +- feat: `clear()` 方法清空图表 +- feat: `changeData(data)` 方法更新图表,需要传数据 +- feat: `repaint()` 方法更新图表:`source` 数据源 更新后,在需要的时候调用 +- feat: `source` 数据源 和 `is-auto-play` 开启自动更新,配置这两个参数只要 `source` 数据源更新,就会更新图表 +## 0.2.2(2021-04-05) +- fix: 修复微信小程序缺少`Transform`报错问题 +## 0.2.1(2021-04-04) +- chore: 考虑到不是所有人需要 `nvue`,所以 `webview` 改为网络路径 , 当然你也可以把html下载放置到项目根目录的`hybrid`文件夹下 +## 0.2.0(2021-04-04) +- chore: 基于 `webview` 实现兼容 `nvue` +## 0.1.0(2021-04-02) +- chore: 第一次上传,基本全端兼容,使用方法与官网一致。 diff --git a/uni_modules/lime-f2/components/lime-f2/canvas.js b/uni_modules/lime-f2/components/lime-f2/canvas.js new file mode 100644 index 0000000..e747e3a --- /dev/null +++ b/uni_modules/lime-f2/components/lime-f2/canvas.js @@ -0,0 +1,121 @@ +import { + pixelRatio, + sleep +} from './utils'; + +const UNI_CANVAS_CONTEXT_MAP = { + // #ifndef MP-WEIXIN + fillStyle: 'FillStyle', + fontSize: 'FontSize', + globalAlpha: 'GlobalAlpha', + opacity: 'GlobalAlpha', + lineCap: 'LineCap', + lineJoin: 'LineJoin', + lineWidth: 'LineWidth', + miterLimit: 'MiterLimit', + strokeStyle: 'StrokeStyle', + textAlign: 'TextAlign', + textBaseline: 'TextBaseline', + shadow: 'Shadow', + // #endif + // #ifdef MP-TOUTIAO || H5 || APP-PLUS + font: 'FontSize', + // #endif +}; + +function strLen(str) { + let len = 0; + for (let i = 0; i < str.length; i++) { + if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) { + len++; + } else { + len += 2; + } + } + return len; +} + +// 头条小程序目前仅支持 setFontSize +// f2 会将所有属性整合为 font 简写,从中提取 fontSize 支持 +const fontSizeReg = /(\d*\.?\d*)px/; +const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g; +export default (ctx) => { + // #ifdef H5 || APP-PLUS + ctx.uniTransform = ctx.transform + ctx.transform = (...agrs) => { + if (ctx.draw && agrs[6]) { + agrs[4] *= pixelRatio + agrs[5] *= pixelRatio + } + if (agrs.length > 6) { + agrs.pop() + } + ctx.uniTransform(...agrs) + } + // #endif + // #ifdef MP-ALIPAY + ctx.canvasGetImageData = ctx.getImageData + ctx.getImageData = null + // #endif + if (!ctx.getImageData) { + ctx.getImageData = (...agrs) => { + const [x, y, width, height] = agrs + return new Promise(resolve => { + const parms = { + canvasId: ctx.id || ctx.canvasId, + x, + y, + width, + height, + success: res => { + resolve(res.data) + } + } + // #ifndef MP-ALIPAY || MP-TOUTIAO + uni.canvasGetImageData(parms) + // #endif + // #ifdef MP-ALIPAY || MP-TOUTIAO + ctx.canvasGetImageData(parms) + // #endif + }) + } + } + // 钉钉小程序框架不支持 measureText 方法,用此方法 mock + if (!ctx.measureText) { + ctx.measureText = text => { + let fontSize = 12; + const font = ctx.__font; + if (font) { + fontSize = parseInt(font.split(' ')[3], 10); + } + fontSize /= 2; + return { + width: strLen(text) * fontSize + }; + } + } + Object.keys(UNI_CANVAS_CONTEXT_MAP).forEach(key => { + Object.defineProperty(ctx, key, { + set(val) { + const name = `set${UNI_CANVAS_CONTEXT_MAP[key]}`; + if (!ctx[name]) { + return; + } + if (key === 'font' && fontSizeReg.test(val)) { + const match = fontSizeReg.exec(val); + ctx[name](match[1]); + return; + } + if (key === 'shadow' && Array.isArray(val)) { + ctx[name](...val); + return; + } + if(colorReg.test(val)) { + val = val.replace(colorReg, '#$1$1$2$2$3$3') + } + ctx[name](val); + } + }); + }); + return ctx +} diff --git a/uni_modules/lime-f2/components/lime-f2/f2.min.js b/uni_modules/lime-f2/components/lime-f2/f2.min.js new file mode 100644 index 0000000..e2336d6 --- /dev/null +++ b/uni_modules/lime-f2/components/lime-f2/f2.min.js @@ -0,0 +1,15 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).F2={})}(this,(function(t){"use strict";var e=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},i=function(t,i){if(!e(t))return t;for(var n=[],r=0;r-1})(i,t)||i.push(t)})),i};function d(t){if(e(t))return t[0]}function v(t){if(e(t)){return t[t.length-1]}}var y=function(t,e){var i=e.toString(),n=i.indexOf(".");if(-1===n)return Math.round(t);var r=i.substr(n+1).length;return r>20&&(r=20),parseFloat(t.toFixed(r))},m=function(t){return r(t,"Number")},x=function(t){return s(t)?"":t.toString()},_=function(t){var e=x(t);return e.charAt(0).toLowerCase()+e.substring(1)};function S(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,i){return"\\"===t.charAt(0)?t.slice(1):void 0===e[i]?"":e[i]})):t}var M=function(t){var e=x(t);return e.charAt(0).toUpperCase()+e.substring(1)},w={}.toString,b=function(t){return r(t,"Boolean")},C=function(t){return r(t,"Date")},P=Object.prototype;function k(t,e){for(var i in e)e.hasOwnProperty(i)&&"constructor"!==i&&void 0!==e[i]&&(t[i]=e[i])}function T(t,e,i,n){return e&&k(t,e),i&&k(t,i),n&&k(t,n),t}function D(t,e,i,n){for(var r in i=i||0,n=n||5,e)if(e.hasOwnProperty(r)){var a=e[r];null!==a&&f(a)?(f(t[r])||(t[r]={}),i0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),C(t)&&(t=t.getTime()),t}var ft=Object.freeze({__proto__:null,Array:H,upperFirst:M,lowerFirst:_,isString:g,isNumber:m,isBoolean:b,isFunction:a,isDate:C,isArray:o,isNil:s,isObject:h,isPlainObject:f,isEqual:E,deepMix:A,mix:T,each:u,uniq:p,find:function(t,e){if(!o(t))return null;var i;if(a(e)&&(i=e),f(e)&&(i=function(t){return function(t,e){var i=l(e),n=i.length;if(s(t))return!n;for(var r=0;r=0;return i?r?2*Math.PI-n:n:r?n:2*Math.PI-n},zero:function(t){return 0===t[0]&&0===t[1]},distance:function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(i*i+n*n)},clone:function(t){return[t[0],t[1]]},min:function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},max:function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},transformMat2d:function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t}},Pt=[1,0,0,1,0,0],kt=function(){var t=e.prototype;function e(t){var e,i;this._initDefaultCfg(),T(this,t),this.plot?(e=this.plot.bl,i=this.plot.tr,this.start=e,this.end=i):(e=this.start,i=this.end),this.init(e,i)}return t._initDefaultCfg=function(){},t._scale=function(t,e){var i=this.matrix,n=this.center;bt.translate(i,i,[n.x,n.y]),bt.scale(i,i,[t,e]),bt.translate(i,i,[-n.x,-n.y])},t.init=function(t,e){this.matrix=[].concat(Pt),this.center={x:(e.x-t.x)/2+t.x,y:(e.y-t.y)/2+t.y},this.scale&&this._scale(this.scale[0],this.scale[1])},t.convertPoint=function(t){var e=this._convertPoint(t),i=e.x,n=e.y;if(!bt.isChanged(this.matrix))return{x:i,y:n};var r=[i,n];return Ct.transformMat2d(r,r,this.matrix),{x:r[0],y:r[1]}},t.invertPoint=function(t){return this._invertPoint(t)},t._convertPoint=function(t){return t},t._invertPoint=function(t){return t},t.reset=function(t){this.plot=t;var e=t.bl,i=t.tr;this.start=e,this.end=i,this.init(e,i)},e}(),Tt=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="cartesian",this.transposed=!1,this.isRect=!0},i.init=function(e,i){t.prototype.init.call(this,e,i),this.x={start:e.x,end:i.x},this.y={start:e.y,end:i.y}},i._convertPoint=function(t){var e=this.transposed,i=e?"y":"x",n=e?"x":"y",r=this.x,a=this.y;return{x:r.start+(r.end-r.start)*t[i],y:a.start+(a.end-a.start)*t[n]}},i._invertPoint=function(t){var e=this.transposed,i=e?"y":"x",n=e?"x":"y",r=this.x,a=this.y,s={};return s[i]=(t.x-r.start)/(r.end-r.start),s[n]=(t.y-a.start)/(a.end-a.start),s},e}(kt);function Dt(t,e){return g(e)?e:t.invert(t.scale(e))}kt.Cartesian=Tt,kt.Rect=Tt;var At=function(){function t(t){var e=this;this.type="base",this.name=null,this.method=null,this.values=[],this.scales=[],this.linear=null;var i=null,n=this.callback;if(t.callback){var r=t.callback;i=function(){for(var t=arguments.length,i=new Array(t),a=0;aa&&(a=l)}(re.max)&&e.change({min:r,max:a})},i._sort=function(t){var e=this.getXScale(),i=e.field,n=e.type;"identity"!==n&&e.values.length>1&&u(t,(function(t){t.sort((function(t,r){return"timeCat"===n?ct(t._origin[i])-ct(r._origin[i]):e.translate(t._origin[i])-e.translate(r._origin[i])}))})),this.set("hasSorted",!0),this.set("dataArray",t)},i.paint=function(){var t=this.get("mappingData"),e=[],i=this.getShapeFactory();i.setCoord(this.get("coord")),this._beforeMapping(t);for(var n=0,r=t.length;n5?l:c,u=t.slice(0,5).map((function(t){var e=t._origin;return n.getText(e[n.field])+":"+r.getText(e[r.field])}));e.push(S(o,{index:i+1,count:a,part:3,name:s[p.field],values:u.join(" ")}))}}}))}t.set("ariaLabel",e.join(""))}},i.createShapePointsCfg=function(t){var e=this.getXScale(),i=this.getYScale();return{x:this._normalizeValues(t[e.field],e),y:i?this._normalizeValues(t[i.field],i):t.y?t.y:.1,y0:i?i.scale(this.getYMinValue()):void 0}},i.getYMinValue=function(){var t=this.getYScale(),e=t.min,i=t.max;return this.get("startOnZero")?i<=0&&e<=0?i:e>=0?e:0:e},i._normalizeValues=function(t,e){var i=[];if(o(t))for(var n=0,r=t.length;ne);r++){if(n[n.length-1][1]<=e){r=n.length-1;break}if(n[r][0]<=e&&n[r][1]>e)break}}else{(n=t.values).sort((function(t,e){return t-e}));for(var o=n.length;re)&&!((n[r-1]+n[r])/2<=e&&(n[r+1]+n[r])/2>e);r++)if((n[n.length-2]+n[n.length-1])/2<=e){r=n.length-1;break}}return n[r]},i.getSnapRecords=function(t){var e=this,i=e.get("coord"),n=e.getXScale(),r=e.getYScale(),a=n.field,h=e.get("dataArray");this.get("hasSorted")||this._sort(h);var u=[],l=i.invertPoint(t),c=l.x;e.isInCircle()&&!i.transposed&&c>(1+n.rangeMax())/2&&(c=n.rangeMin());var f=n.invert(c);n.isCategory||(f=e._getSnap(n,f));var g=[];if(h.forEach((function(t){t.forEach((function(t){var i=s(t._origin)?t[a]:t._origin[a];e._isEqual(i,f,n)&&g.push(t)}))})),this.hasAdjust("stack")&&i.isPolar&&i.transposed){if(c>=0&&c<=1){var p=r.invert(l.y);p=e._getSnap(r,p,g),g.forEach((function(t){(o(p)?t._originY.toString()===p.toString():t._originY===p)&&u.push(t)}))}}else u=g;return u},i.getRecords=function(t){var e=this,i=this.getXScale(),n=this.get("dataArray"),r=i.field;return n.map((function(n){for(var a=n.length-1;a>=0;a--){var o=n[a],h=s(o._origin)?o[r]:o._origin[r];if(e._isEqual(h,t,i))return o}return null}))},i._isEqual=function(t,e,i){return"timeCat"===i.type?ct(t)===e:e===t},i.position=function(t){return this._setAttrOptions("position",{field:t}),this},i.color=function(t,e){return this._createAttrOption("color",t,e,vt.colors),this},i.size=function(t,e){return this._createAttrOption("size",t,e,vt.sizes),this},i.shape=function(t,e){var i=this.get("type"),n=vt.shapes[i]||[];return this._createAttrOption("shape",t,e,n),this},i.style=function(t,e){var i,n=this.get("styleOptions");return n||(n={},this.set("styleOptions",n)),h(t)&&(e=t,t=null),t&&(i=Ut(t)),n.fields=i,n.style=e,this},i.adjust=function(t){return g(t)&&(t={type:t}),this.set("adjust",t),this},i.animate=function(t){return this.set("animateCfg",t),this},i.changeData=function(t){this.set("data",t),this.set("scales",{}),this.get("isInit")&&(this.set("isInit",!1),this.init())},i.clearInner=function(){var t=this.get("container");t&&t.clear()},i.reset=function(){this.set("isInit",!1),this.set("attrs",{}),this.set("attrOptions",{}),this.set("adjust",null),this.clearInner()},i.clear=function(){this.clearInner()},i.destroy=function(){this.set("isInit",!1),this.clear(),t.prototype.destroy.call(this)},i._display=function(t){this.set("visible",t);var e=this.get("container"),i=e.get("canvas");e.set("visible",t),i.draw()},i.show=function(){this._display(!0)},i.hide=function(){this._display(!1)},e}(Mt),$t={};function Kt(t){return $t[t]}function Qt(t,e){$t[t]=e}var te=function(){function t(t){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=t,this.initCfg(),this.init()}return t.prototype.translate=function(t){return t},t.prototype.change=function(t){T(this.__cfg__,t),this.init()},t.prototype.clone=function(){return this.constructor(this.__cfg__)},t.prototype.getTicks=function(){var t=this;return N(this.ticks,(function(e,i){return h(e)?e:{text:t.getText(e,i),tickValue:e,value:t.scale(e)}}))},t.prototype.getText=function(t,e){var i=this.formatter,n=i?i(t,e):t;return s(n)||!a(n.toString)?"":n.toString()},t.prototype.getConfig=function(t){return this.__cfg__[t]},t.prototype.init=function(){T(this,this.__cfg__),this.setDomain(),O(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},t.prototype.initCfg=function(){},t.prototype.setDomain=function(){},t.prototype.calculateTicks=function(){var t=this.tickMethod,e=[];if(g(t)){var i=Kt(t);if(!i)throw new Error("There is no method to to calculate ticks!");e=i(this)}else a(t)&&(e=t(this));return e},t.prototype.rangeMin=function(){return d(this.range)},t.prototype.rangeMax=function(){return v(this.range)},t.prototype.calcPercent=function(t,e,i){return m(t)?(t-e)/(i-e):NaN},t.prototype.calcValue=function(t,e,i){return e+t*(i-e)},t}(),ee=function(t,e){return(ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)}; +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */function ie(t,e){function i(){this.constructor=t}ee(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function ne(){for(var t=0,e=0,i=arguments.length;ethis.max?NaN:this.values[n]},e.prototype.getText=function(e){for(var i=[],n=1;n1?t-1:t}},e}(te),ae=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,se="[^\\s]+",oe=/\[([^]*?)\]/gm;function he(t,e){for(var i=[],n=0,r=t.length;n-1?n:null}};function le(t){for(var e=[],i=1;i3?0:(t-t%10!=10?1:0)*t%10]}},de=le({},pe),ve=function(t){return de=le(de,t)},ye=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},me=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+me(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+me(Math.floor(Math.abs(e)/60),2)+":"+me(Math.abs(e)%60,2)}},_e=function(t){return+t-1},Se=[null,"[1-9]\\d?"],Me=[null,se],we=["isPm",se,function(t,e){var i=t.toLowerCase();return i===e.amPm[0]?0:i===e.amPm[1]?1:null}],be=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var i=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?i:-i}return 0}],Ce={D:["day","[1-9]\\d?"],DD:["day","\\d\\d"],Do:["day","[1-9]\\d?"+se,function(t){return parseInt(t,10)}],M:["month","[1-9]\\d?",_e],MM:["month","\\d\\d",_e],YY:["year","\\d\\d",function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour","[1-9]\\d?",void 0,"isPm"],hh:["hour","\\d\\d",void 0,"isPm"],H:["hour","[1-9]\\d?"],HH:["hour","\\d\\d"],m:["minute","[1-9]\\d?"],mm:["minute","\\d\\d"],s:["second","[1-9]\\d?"],ss:["second","\\d\\d"],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond","\\d\\d",function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:Se,dd:Se,ddd:Me,dddd:Me,MMM:["month",se,ue("monthNamesShort")],MMMM:["month",se,ue("monthNames")],a:we,A:we,ZZ:be,Z:be},Pe={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},ke=function(t){return le(Pe,t)},Te=function(t,e,i){if(void 0===e&&(e=Pe.default),void 0===i&&(i={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var n=[];e=(e=Pe[e]||e).replace(oe,(function(t,e){return n.push(e),"@@@"}));var r=le(le({},de),i);return(e=e.replace(ae,(function(e){return xe[e](t,r)}))).replace(/@@@/g,(function(){return n.shift()}))};function De(t,e,i){if(void 0===i&&(i={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=Pe[e]||e,t.length>1e3)return null;var n={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},r=[],a=[],s=e.replace(oe,(function(t,e){return a.push(ye(e)),"@@@"})),o={},h={};s=ye(s).replace(ae,(function(t){var e=Ce[t],i=e[0],n=e[1],a=e[3];if(o[i])throw new Error("Invalid format. "+i+" specified twice in format");return o[i]=!0,a&&(h[a]=!0),r.push(e),"("+n+")"})),Object.keys(h).forEach((function(t){if(!o[t])throw new Error("Invalid format. "+t+" is required in specified format")})),s=s.replace(/@@@/g,(function(){return a.shift()}));var u=t.match(new RegExp(s,"i"));if(!u)return null;for(var l=le(le({},de),i),c=1;c0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),C(t)&&(t=t.getTime()),t}var Ee=36e5,Ne=24*Ee,Fe=31*Ne,ze=[["HH:mm:ss",1e3],["HH:mm:ss",1e4],["HH:mm:ss",3e4],["HH:mm",6e4],["HH:mm",6e5],["HH:mm",18e5],["HH",Ee],["HH",6*Ee],["HH",12*Ee],["YYYY-MM-DD",Ne],["YYYY-MM-DD",4*Ne],["YYYY-WW",7*Ne],["YYYY-MM",Fe],["YYYY-MM",4*Fe],["YYYY-MM",6*Fe],["YYYY",380*Ne]];function Be(t,e,i){var n,r=(n=function(t){return t[1]},function(t,e,i,r){for(var a=s(i)?0:i,o=s(r)?t.length:r;a>>1;n(t[h])>e?o=h:a=h+1}return a})(ze,(e-t)/i)-1,a=ze[r];return r<0?a=ze[0]:r>=ze.length&&(a=v(ze)),a}var Xe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeCat",e}return ie(e,t),e.prototype.translate=function(t){t=Oe(t);var e=this.values.indexOf(t);return-1===e&&(e=m(t)&&t-1){var n=this.values[i],r=this.formatter;return n=r?r(n,e):Ye(n,this.mask)}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var e=this.values;u(e,(function(t,i){e[i]=Oe(t)})),e.sort((function(t,e){return t-e})),t.prototype.setDomain.call(this)},e}(re),Le=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isContinuous=!0,e}return ie(e,t),e.prototype.scale=function(t){if(s(t))return NaN;var e=this.rangeMin(),i=this.rangeMax();return this.max===this.min?e:e+this.getScalePercent(t)*(i-e)},e.prototype.init=function(){t.prototype.init.call(this);var e=this.ticks,i=d(e),n=v(e);ithis.max&&(this.max=n),s(this.minLimit)||(this.min=i),s(this.maxLimit)||(this.max=n)},e.prototype.setDomain=function(){var t=function(t){var e=t.filter((function(t){return!isNaN(t)}));if(!e.length)return{min:0,max:0};if(o(t[0])){for(var i=[],n=0;nthis.max&&(this.min=e,this.max=i)},e.prototype.calculateTicks=function(){var e=this,n=t.prototype.calculateTicks.call(this);return this.nice||(n=i(n,(function(t){return t>=e.min&&t<=e.max}))),n},e.prototype.getScalePercent=function(t){var e=this.max,i=this.min;return(t-i)/(e-i)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(te),je=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return ie(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t);return this.min+e*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(Le);function Ge(t,e){var i=Math.E;return e>=0?Math.pow(i,Math.log(e)/t):-1*Math.pow(i,Math.log(-e)/t)}function Re(t,e){return 1===t?1:Math.log(e)/Math.log(t)}function He(t,e,i){s(i)&&(i=Math.max.apply(null,t));var n=i;return u(t,(function(t){t>0&&t1&&(n=1),n}var We=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e}return ie(e,t),e.prototype.invert=function(t){var e,i=this.base,n=Re(i,this.max),r=this.rangeMin(),a=this.rangeMax()-r,s=this.positiveMin;if(s){if(0===t)return 0;var o=1/(n-(e=Re(i,s/i)))*a;if(t=0?1:-1;return Math.pow(a,i)*s},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var e=this.max,i=this.min;if(e===i)return 0;var n=this.exponent;return(Ge(n,t)-Ge(n,i))/(Ge(n,e)-Ge(n,i))},e}(Le),qe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="time",e}return ie(e,t),e.prototype.getText=function(t,e){var i=this.translate(t),n=this.formatter;return n?n(i,e):Ye(i,this.mask)},e.prototype.scale=function(e){var i=e;return(g(i)||C(i))&&(i=this.translate(i)),t.prototype.scale.call(this,i)},e.prototype.translate=function(t){return Oe(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,e=this.getConfig("min"),i=this.getConfig("max");if(s(e)&&m(e)||(this.min=this.translate(this.min)),s(i)&&m(i)||(this.max=this.translate(this.max)),t&&t.length){var n=[],r=1/0,a=r,o=0;u(t,(function(t){var e=Oe(t);if(isNaN(e))throw new TypeError("Invalid Time: "+t+" in time scale!");r>e?(a=r,r=e):a>e&&(a=e),o1&&(this.minTickInterval=a-r),s(e)&&(this.min=r),s(i)&&(this.max=o)}},e}(je),Ze=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantize",e}return ie(e,t),e.prototype.invert=function(t){var e=this.ticks,i=e.length,n=this.getInvertPercent(t),r=Math.floor(n*(i-1));if(r>=i-1)return v(e);if(r<0)return d(e);var a=e[r],s=r/(i-1);return a+(n-s)/((r+1)/(i-1)-s)*(e[r+1]-a)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var e=t.prototype.calculateTicks.call(this);return this.nice||(v(e)!==this.max&&e.push(this.max),d(e)!==this.min&&e.unshift(this.min)),e},e.prototype.getScalePercent=function(t){var e=this.ticks;if(tv(e))return 1;var i=0;return u(e,(function(e,n){if(!(t>=e))return!1;i=n})),i/(e.length-1)},e}(Le),Ue=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantile",e}return ie(e,t),e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(Ze),Je={};function $e(t){return Je[t]}function Ke(t,e){if($e(t))throw new Error("type '"+t+"' existed.");Je[t]=e}var Qe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return ie(e,t),e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&m(t)?t:this.range[0]},e.prototype.invert=function(t){var e=this.range;return te[1]?NaN:this.values[0]},e}(te),ti=[1,5,2,2.5,4,3],ei=100*Number.EPSILON;function ii(t,e,i,n,r,a){var s=F(e),o=I(e,t),h=0,u=function(t,e){return(t%e+e)%e}(n,a);return(u=0&&(h=1),1-o/(s-1)-i+h}function ni(t,e,i){var n=F(e);return 1-I(e,t)/(n-1)-i+1}function ri(t,e,i,n,r,a){var s=(t-1)/(a-r),o=(e-1)/(Math.max(a,n)-Math.min(i,r));return 2-Math.max(s/o,o/s)}function ai(t,e){return t>=e?2-(t-1)/(e-1):1}function si(t,e,i,n){var r=e-t;return 1-.5*(Math.pow(e-n,2)+Math.pow(t-i,2))/Math.pow(.1*r,2)}function oi(t,e,i){var n=e-t;if(i>n){var r=(i-n)/2;return 1-Math.pow(r,2)/Math.pow(.1*n,2)}return 1}function hi(t,e,i,n,r,a){if(void 0===i&&(i=5),void 0===n&&(n=!0),void 0===r&&(r=ti),void 0===a&&(a=[.25,.2,.5,.05]),"number"!=typeof t||"number"!=typeof e)return{min:0,max:0,ticks:[]};if(t===e||1===i)return{min:t,max:e,ticks:[t]};for(var s={score:-2,lmin:0,lmax:0,lstep:0},o=1;o<1/0;){for(var h=0,u=r;hS)y+=1;else{for(var M=_;M<=S;M+=1){var w=M*(m/o),b=w+m*(f-1),C=m,P=ii(l,r,o,w,b,C),k=si(t,e,w,b),T=ri(f,i,t,e,w,b),D=a[0]*P+a[1]*k+a[2]*T+1*a[3];D>s.score&&(!n||w<=t&&b>=e)&&(s.lmin=w,s.lmax=b,s.lstep=C,s.score=D)}y+=1}}f+=1}}o+=1}for(var A=Number.isInteger(s.lstep)?0:Math.ceil(Math.abs(Math.log10(s.lstep))),I=[],Y=s.lmin;Y<=s.lmax;Y+=s.lstep)I.push(Y);var O=A?N(I,(function(t){return Number.parseFloat(t.toFixed(A))})):I;return{min:Math.min(t,d(O)),max:Math.max(e,v(O)),ticks:O}}function ui(t){var e=t.values,n=t.tickInterval,r=t.tickCount,a=e;if(m(n))return i(a,(function(t,e){return e%n==0}));var o=t.min,h=t.max;if(s(o)&&(o=0),s(h)&&(h=e.length-1),m(r)&&r=o&&t<=h})).map((function(t){return e[t]}))}return e.slice(o,h+1)}var li=Math.sqrt(50),ci=Math.sqrt(10),fi=Math.sqrt(2),gi=function(){function t(){this._domain=[0,1]}return t.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},t.prototype.nice=function(t){var e,i;void 0===t&&(t=5);var n,r=this._domain.slice(),a=0,s=this._domain.length-1,o=this._domain[a],h=this._domain[s];return h0?n=pi(o=Math.floor(o/n)*n,h=Math.ceil(h/n)*n,t):n<0&&(n=pi(o=Math.ceil(o*n)/n,h=Math.floor(h*n)/n,t)),n>0?(r[a]=Math.floor(o/n)*n,r[s]=Math.ceil(h/n)*n,this.domain(r)):n<0&&(r[a]=Math.ceil(o*n)/n,r[s]=Math.floor(h*n)/n,this.domain(r)),this},t.prototype.ticks=function(t){return void 0===t&&(t=5),function(t,e,i){var n,r,a,s,o=-1;if(i=+i,(t=+t)===(e=+e)&&i>0)return[t];(n=e0)for(t=Math.ceil(t/s),e=Math.floor(e/s),a=new Array(r=Math.ceil(e-t+1));++o=0?(a>=li?10:a>=ci?5:a>=fi?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(a>=li?10:a>=ci?5:a>=fi?2:1)}function di(t,e,i){return("ceil"===i?Math.ceil(t/e):"floor"===i?Math.floor(t/e):Math.round(t/e))*e}function vi(t,e,i){var n=di(t,i,"floor"),r=di(e,i,"ceil");n=y(n,i),r=y(r,i);for(var a=[],s=n;s<=r;s+=i){var o=y(s,i);a.push(o)}return{min:n,max:r,ticks:a}}function yi(t,e,i){var n,r=t.minLimit,a=t.maxLimit,o=t.min,h=t.max,u=t.tickCount,l=void 0===u?5:u,c=s(r)?s(e)?o:e:r,f=s(a)?s(i)?h:i:a;if(c>f&&(f=(n=[c,f])[0],c=n[1]),l<=2)return[c,f];for(var g=(f-c)/(l-1),p=[],d=0;d1&&(r*=Math.ceil(s)),n&&r31536e6)for(var h=_i(i),u=Math.ceil(a/31536e6),l=o;l<=h+u;l+=u)s.push(Si(l));else if(a>Fe){var c=Math.ceil(a/Fe),f=Mi(e),g=function(t,e){var i=_i(t),n=_i(e),r=Mi(t);return 12*(n-i)+(Mi(e)-r)%12}(e,i);for(l=0;l<=g+c;l+=c)s.push(wi(o,l+f))}else if(a>Ne){var p=(x=new Date(e)).getFullYear(),d=x.getMonth(),v=x.getDate(),y=Math.ceil(a/Ne),m=function(t,e){return Math.ceil((e-t)/Ne)}(e,i);for(l=0;lEe){p=(x=new Date(e)).getFullYear(),d=x.getMonth(),y=x.getDate();var x,_=x.getHours(),S=Math.ceil(a/Ee),M=function(t,e){return Math.ceil((e-t)/Ee)}(e,i);for(l=0;l<=M+S;l+=S)s.push(new Date(p,d,y,_+l).getTime())}else if(a>6e4){var w=function(t,e){return Math.ceil((e-t)/6e4)}(e,i),b=Math.ceil(a/6e4);for(l=0;l<=w+b;l+=b)s.push(e+6e4*l)}else{var C=a;C<1e3&&(C=1e3);var P=1e3*Math.floor(e/1e3),k=Math.ceil((i-e)/1e3),T=Math.ceil(C/1e3);for(l=0;l=512&&console.warn("Notice: current ticks length("+s.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+a+") is too small, increase the value to solve the problem!"),s})),Qt("log",(function(t){var e,i=t.base,n=t.tickCount,r=t.min,a=t.max,s=t.values,o=Re(i,a);if(r>0)e=Math.floor(Re(i,r));else{var h=He(s,i,a);e=Math.floor(Re(i,h))}for(var u=o-e,l=Math.ceil(u/n),c=[],f=e;f=0?1:-1;return Math.pow(t,e)*i}))})),Qt("quantile",(function(t){var e=t.tickCount,i=t.values;if(!i||!i.length)return[];for(var n=i.slice().sort((function(t,e){return t-e})),r=[],a=0;a=i?r[r.length-1]=s:r.push(s)),r},Ci=[1,1.2,1.5,2,2.2,2.4,2.5,3,4,5,6,7.5,8,10];function Pi(t){var e=1;if(0===(t=Math.abs(t)))return e;if(t<1){for(var i=0;t<1;)e/=10,t*=10,i++;return e.toString().length>12&&(e=parseFloat(e.toFixed(i))),e}for(;t>10;)e*=10,t/=10;return e}function ki(t){var e=t.interval,i=t.tickCount,n=t.max,r=t.min;return Math.floor(r/e)*e+(i-1)*e>=n}function Ti(t){var e=t.toString(),i=e.indexOf("."),n=e.indexOf("e-"),r=n>=0?parseInt(e.substr(n+2),10):e.substr(i+1).length;return r>20&&(r=20),r}function Di(t,e){return parseFloat(t.toFixed(e))}var Ai=$e("linear"),Ii=$e("identity"),Yi=$e("category"),Oi=$e("timeCat");function Ei(t){Object.keys(t).forEach((function(e){delete t[e]}))}Qt("cat",bi),Qt("time-cat",bi),Qt("wilkinson-extended",(function(t){var e=t||{},i=e.tickCount,n=e.tickInterval,r=t||{},a=r.min,s=r.max;a=isNaN(a)?0:a,s=isNaN(s)?0:s;var o=i&&i>=2?i:5,h=n||function(t){var e=t.tickCount,i=t.min,n=t.max;if(i===n)return 1*Pi(n);for(var r=(n-i)/(e-1),a=Pi(r),s=r/a,o=n/a,h=i/a,u=0,l=0;l0?t.change({min:0}):r<0&&t.change({max:0}))},e.clear=function(){Ei(this.defs),Ei(this.scales),this.data=null},t}(),Fi=function(){var t=e.prototype;function e(t){this._initDefaultCfg(),T(this,t),this.draw()}return t._initDefaultCfg=function(){this.ticks=[],this.tickLine={},this.offsetFactor=1,this.frontContainer=null,this.backContainer=null,this.gridPoints=[]},t.draw=function(){var t=this.line,e=this.tickLine,i=this.label,n=this.grid;n&&this.drawGrid(n),e&&this.drawTicks(e),t&&this.drawLine(t),i&&this.drawLabels()},t.drawTicks=function(t){var e=this,i=e.ticks,n=t.length,r=e.getContainer(t.top);u(i,(function(i){var a=e.getOffsetPoint(i.value),s=e.getSidePoint(a,n);r.addShape("line",{className:"axis-tick",attrs:T({x1:a.x,y1:a.y,x2:s.x,y2:s.y},t)})._id=e._id+"-ticks"}))},t.drawLabels=function(){var t=this,e=t.labelOffset;u(t.labels,(function(i){var n=t.getContainer(i.get("top")),r=t.getOffsetPoint(i.get("value")),a=t.getSidePoint(r,e),s=a.x,o=a.y;i.attr(T({x:s,y:o},t.getTextAlignInfo(r,e),i.get("textStyle"))),i._id=t._id+"-"+i.attr("text"),n.add(i)}))},t.drawLine=function(){},t.drawGrid=function(t){var e=this,i=e.gridPoints,n=e.ticks,r=t,s=i.length;u(i,(function(i,o){if(a(t)){var h=n[o]||{},u=t(h.text,o,s);r=u?T({},vt._defaultAxis.grid,u):null}if(r){var l,c=r.type,f=i.points,g=e.getContainer(r.top);if("arc"===c){var p=e.center,d=e.startAngle,v=e.endAngle,y=Ct.length([f[0].x-p.x,f[0].y-p.y]);l=g.addShape("Arc",{className:"axis-grid",attrs:T({x:p.x,y:p.y,startAngle:d,endAngle:v,r:y},r)})}else l=g.addShape("Polyline",{className:"axis-grid",attrs:T({points:f},r)});l._id=i._id}}))},t.getOffsetPoint=function(){},t.getAxisVector=function(){},t.getOffsetVector=function(t,e){var i=this.getAxisVector(t),n=Ct.normalize([],i),r=this.offsetFactor,a=[-1*n[1]*r,n[0]*r];return Ct.scale([],a,e)},t.getSidePoint=function(t,e){var i=this.getOffsetVector(t,e);return{x:t.x+i[0],y:t.y+i[1]}},t.getTextAlignInfo=function(t,e){var i=this.getOffsetVector(t,e);return{textAlign:i[0]>0?"left":i[0]<0?"right":"center",textBaseline:i[1]>0?"top":i[1]<0?"bottom":"middle"}},t.getContainer=function(t){var e=this.frontContainer,i=this.backContainer;return t?e:i},e}(),zi=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){t.prototype._initDefaultCfg.call(this),this.start=null,this.end=null},i.getOffsetPoint=function(t){var e=this.start,i=this.end;return{x:e.x+(i.x-e.x)*t,y:e.y+(i.y-e.y)*t}},i.getAxisVector=function(){var t=this.start,e=this.end;return[e.x-t.x,e.y-t.y]},i.drawLine=function(t){var e=this.getContainer(t.top),i=this.start,n=this.end;e.addShape("line",{className:"axis-line",attrs:T({x1:i.x,y1:i.y,x2:n.x,y2:n.y},t)})},e}(Fi);Fi.Line=zi;var Bi=function(){function t(t){this.axisCfg={},this.frontPlot=null,this.backPlot=null,this.axes={},T(this,t)}var e=t.prototype;return e._isHide=function(t){var e=this.axisCfg;return!e||!1===e[t]},e._getLinePosition=function(t,e,i,n){var r="",a=t.field,s=this.axisCfg;return s[a]&&s[a].position?r=s[a].position:"x"===e?r=n?"left":"bottom":"y"===e&&(r=i?"right":"left",n&&(r="bottom")),r},e._getLineCfg=function(t,e,i){var n,r,a=1;return"x"===e?(n={x:0,y:0},r={x:1,y:0}):"right"===i?(n={x:1,y:0},r={x:1,y:1}):(n={x:0,y:0},r={x:0,y:1},a=-1),t.transposed&&(a*=-1),{offsetFactor:a,start:t.convertPoint(n),end:t.convertPoint(r)}},e._getCircleCfg=function(t){return{startAngle:t.startAngle,endAngle:t.endAngle,center:t.center,radius:t.circleRadius}},e._getRadiusCfg=function(t){var e,i;return t.transposed?(e={x:0,y:0},i={x:1,y:0}):(e={x:0,y:0},i={x:0,y:1}),{offsetFactor:-1,start:t.convertPoint(e),end:t.convertPoint(i)}},e._getAxisCfg=function(t,e,i,n,r){var s=this,o=this,h=this.axisCfg,l=e.getTicks(),c=A({ticks:l,frontContainer:this.frontPlot,backContainer:this.backPlot},r,h[e.field]),f=[],g=c.label,p=l.length,d=0,v=0,y=g;return u(l,(function(t,e){if(a(g)){var i=g(t.text,e,p);y=i?T({},vt._defaultAxis.label,i):null}if(y){var n={};y.textAlign&&(n.textAlign=y.textAlign),y.textBaseline&&(n.textBaseline=y.textBaseline);var r=(y.top?s.frontPlot:s.backPlot).addShape("text",{className:"axis-label",aria:!1,attrs:T({x:0,y:0,text:t.text,fontFamily:o.chart.get("canvas").get("fontFamily")},y),value:t.value,textStyle:n,top:y.top,context:o.chart.get("canvas").get("context")});f.push(r);var h=r.getBBox(),u=h.width,l=h.height;d=Math.max(d,u),v=Math.max(v,l)}})),c.labels=f,c.maxWidth=d,c.maxHeight=v,c},e._createAxis=function(t,e,i,n,r){void 0===r&&(r="");var a,s,o,h=t.type,u=t.transposed;if("cartesian"===h||"rect"===h){var l=this._getLinePosition(e,n,r,u);(o=vt.axis[l]).position=l,a="Line",s=l}else"x"===n&&!u||"y"===n&&u?(o=vt.axis.circle,a="Circle",s="circle"):(o=vt.axis.radius,a="Line",s="radius");var c=this._getAxisCfg(t,e,i,n,o);c.type=a,c.dimType=n,c.verticalScale=i,c.index=r,this.axes[s]=c},e.createAxis=function(t,e,i){var n=this;e&&!n._isHide(e.field)&&n._createAxis(t,e,i[0],"x"),u(i,(function(i,r){n._isHide(i.field)||n._createAxis(t,i,e,"y",r)}));var r=this.axes,a=n.chart;if(a._isAutoPadding()){var o=ut(a.get("padding")),h=ut(a.get("appendPadding")),l=a.get("legendRange")||{top:0,right:0,bottom:0,left:0},c=["auto"===o[0]?l.top+2*h[0]:o[0],"auto"===o[1]?l.right+h[1]:o[1],"auto"===o[2]?l.bottom+h[2]:o[2],"auto"===o[3]?l.left+h[3]:o[3]];if(t.isPolar){var f=r.circle;if(f){var g=f.maxHeight,p=f.maxWidth,d=f.labelOffset;c[0]+=g+d,c[1]+=p+d,c[2]+=g+d,c[3]+=p+d}}else{if(r.right&&"auto"===o[1]){var v=r.right,y=v.maxWidth,m=v.labelOffset;c[1]+=y+m}if(r.left&&"auto"===o[3]){var x=r.left,_=x.maxWidth,S=x.labelOffset;c[3]+=_+S}if(r.bottom&&"auto"===o[2]){var M=r.bottom,w=M.maxHeight,b=M.labelOffset;c[2]+=w+b}}a.set("_padding",c),a._updateLayout(c)}u(r,(function(e){var i,r=e.type,a=e.grid,o=e.verticalScale,h=e.ticks,l=e.dimType,c=e.position,f=e.index;if(t.isPolar?"Line"===r?i=n._getRadiusCfg(t):"Circle"===r&&(i=n._getCircleCfg(t)):i=n._getLineCfg(t,l,c),a&&o){var g=[],p=function(t){var e=t.slice(0);if(e.length>0){var i=e[0],n=e[e.length-1];0!==i.value&&e.unshift({value:0}),1!==n.value&&e.push({value:1})}return e}(o.getTicks());u(h,(function(e){var i=[];u(p,(function(n){var r="x"===l?e.value:n.value,a="x"===l?n.value:e.value;if(r>=0&&r<=1&&a>=0&&a<=1){var s=t.convertPoint({x:r,y:a});i.push(s)}})),g.push({points:i,_id:"axis-"+l+f+"-grid-"+e.tickValue})})),e.gridPoints=g,t.isPolar&&(e.center=t.center,e.startAngle=t.startAngle,e.endAngle=t.endAngle)}i._id="axis-"+l,s(f)||(i._id="axis-"+l+f),new Fi[r](T(e,i))}))},e.clear=function(){this.axes={},this.frontPlot.clear(),this.backPlot.clear()},t}(),Xi=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},Li=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)},ji=function(){function t(t){var e=this,i=t.canvas,n=t.el;yt(this,"_click",(function(t){var i=st(t,e.canvas);t.points=i,e.emitEvent("click",t)})),yt(this,"_start",(function(t){var i,n,r=st(t,e.canvas);r&&(t.points=r,e.emitEvent("touchstart",t),e.reset(),e.startTime=Date.now(),e.startPoints=r,r.length>1?(e.startDistance=Li(r[0],r[1]),e.center=(i=r[0],n=r[1],{x:i.x+(n.x-i.x)/2,y:i.y+(n.y-i.y)/2})):e.pressTimeout=setTimeout((function(){t.direction="none",e.emitStart("press",t),e.emitEvent("press",t),e.eventType="press",e.direction="none"}),250))})),yt(this,"_move",(function(t){var i=st(t,e.canvas);if(i){e.clearPressTimeout(),t.points=i,e.emitEvent("touchmove",t);var n=e.startPoints;if(n)if(i.length>1){var r=e.startDistance,a=Li(i[0],i[1]);t.zoom=a/r,t.center=e.center,e.emitStart("pinch",t),e.emitEvent("pinch",t)}else{var s=i[0].x-n[0].x,o=i[0].y-n[0].y,h=e.direction||Xi(n[0],i[0]);e.direction=h;var u=e.getEventType(i);t.direction=h,t.deltaX=s,t.deltaY=o,e.emitStart(u,t),e.emitEvent(u,t);var l=e.lastMoveTime,c=Date.now();c-l>0&&(e.prevMoveTime=l,e.prevMovePoints=e.lastMovePoints,e.lastMoveTime=c,e.lastMovePoints=i)}}})),yt(this,"_end",(function(t){var i=st(t,e.canvas);t.points=i,e.emitEnd(t),e.emitEvent("touchend",t);var n=e.lastMoveTime;if(Date.now()-n<100){var r=n-(e.prevMoveTime||e.startTime);if(r>0){var a=e.prevMovePoints||e.startPoints,s=e.lastMovePoints,o=Li(a[0],s[0])/r;o>.3&&(t.velocity=o,t.direction=Xi(a[0],s[0]),e.emitEvent("swipe",t))}}e.reset();var h=t.touches;h&&h.length>0&&e._start(t)})),yt(this,"_cancel",(function(t){e.emitEvent("touchcancel",t),e.reset()})),this.canvas=i,this.delegateEvent(n),this.processEvent={}}var e=t.prototype;return e.delegateEvent=function(t){t.addEventListener("click",this._click),t.addEventListener("touchstart",this._start),t.addEventListener("touchmove",this._move),t.addEventListener("touchend",this._end),t.addEventListener("touchcancel",this._cancel)},e.emitEvent=function(t,e){this.canvas.emit(t,e)},e.getEventType=function(t){var e,i=this.eventType,n=this.canvas,r=this.startTime,a=this.startPoints;if(i)return i;var s=n.__events.pan;s&&s.length?e=Date.now()-r>250&&Li(a[0],t[0])<10?"press":"pan":e="press";return this.eventType=e,e},e.enable=function(t){this.processEvent[t]=!0},e.isProcess=function(t){return this.processEvent[t]},e.emitStart=function(t,e){this.isProcess(t)||(this.enable(t),this.emitEvent(t+"start",e))},e.emitEnd=function(t){var e=this,i=this.processEvent;Object.keys(i).forEach((function(n){e.emitEvent(n+"end",t),delete i[n]}))},e.clearPressTimeout=function(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=0)},e.reset=function(){this.clearPressTimeout(),this.startTime=0,this.startPoints=null,this.startDistance=0,this.direction=null,this.eventType=null,this.pinch=!1,this.prevMoveTime=0,this.prevMovePoints=null,this.lastMoveTime=0,this.lastMovePoints=null},t}(),Gi=function(t){function e(e){var i;return(i=t.call(this)||this).context=e,i.width=0,i.height=0,i.style={},i.currentStyle={},i.attrs={},i.isCanvasElement=!0,i}xt(e,t);var i=e.prototype;return i.getContext=function(){return this.context},i.getBoundingClientRect=function(){return{top:0,right:this.width,bottom:this.height,left:0}},i.setAttribute=function(t,e){this.attrs[t]=e},i.addEventListener=function(t,e){this.on(t,e)},i.removeEventListener=function(t,e){this.off(t,e)},i.dispatchEvent=function(t,e){this.emit(t,e)},e}(St);var Ri=function(t){return t?function(t){if(!t)return!1;if(1!==t.nodeType||!t.nodeName||"canvas"!==t.nodeName.toLowerCase())return!1;var e=!1;try{t.addEventListener("eventTest",(function(){e=!0})),t.dispatchEvent(new Event("eventTest"))}catch(t){e=!1}return e}(t.canvas)?t.canvas:new Gi(t):null};function Hi(t,e){u(t,(function(t){t=t.split(":"),e.addColorStop(Number(t[0]),t[1])}))}function Wi(t,e,i){if("("===t[1])try{var n=t[0];if("l"===n)return function(t,e,i){var n,r,a=t.split(" "),s=a[0].slice(2,a[0].length-1);n=parseFloat(s)*Math.PI/180,r=2*Math.PI,s=(n%r+r)%r;var o,h,u=a.slice(1),l=e.getBBox(),c=l.minX,f=l.minY,g=l.maxX,p=l.maxY;s>=0&&s<.5*Math.PI?(o={x:c,y:f},h={x:g,y:p}):.5*Math.PI<=s&&s-1?(null===t.get("canvas")&&(t=Object.assign({},t)),t.set("parent",this.get("parent")),t.set("context",this.get("context")),t):null},t.attr=function(t,e){var i=this;if(i.get("destroyed"))return null;var n=arguments.length;if(0===n)return i._attrs.attrs;if(h(t)){for(var r in this._attrs.bbox=null,t)i._setAttr(r,t[r]);return i._afterAttrsSet&&i._afterAttrsSet(),i}return 2===n?(this._attrs.bbox=null,i._setAttr(t,e),i._afterAttrsSet&&i._afterAttrsSet(),i):i._getAttr(t)},t.getParent=function(){return this.get("parent")},t.draw=function(t){this.get("destroyed")||this.get("visible")&&(this.setContext(t),this.drawInner(t),this.restoreContext(t))},t.setContext=function(t){var e=this._attrs.attrs.clip;t.save(),e&&(e.resetTransform(t),e.createPath(t),t.clip()),this.resetContext(t),this.resetTransform(t)},t.restoreContext=function(t){t.restore()},t.resetContext=function(t){var e=this._attrs.attrs;for(var i in e)if(qi.indexOf(i)>-1){var n=e[i];"fillStyle"!==i&&"strokeStyle"!==i||!n||(n=Wi(n,this,t)),"lineDash"===i&&t.setLineDash&&o(n)?t.setLineDash(n):t[i]=n}},t.hasFill=function(){return this.get("canFill")&&this._attrs.attrs.fillStyle},t.hasStroke=function(){return this.get("canStroke")&&this._attrs.attrs.strokeStyle},t.drawInner=function(){},t.show=function(){return this.set("visible",!0),this},t.hide=function(){return this.set("visible",!1),this},t.isVisible=function(){return this.get("visible")},t.getAriaLabel=function(){var t=this._attrs,e=t.destroyed,i=t.visible,n=t.isShape,r=t.aria;if(!e&&i&&(!n||r))return this._getAriaLabel()},t._getAriaLabel=function(){return this._attrs.ariaLabel},t._removeFromParent=function(){var t=this.get("parent");t&&G(t.get("children"),this);return this},t.remove=function(t){t?this.destroy():this._removeFromParent()},t.destroy=function(){if(this.get("destroyed"))return null;this._removeFromParent(),this._attrs={},this.set("destroyed",!0)},t.getBBox=function(){return{minX:0,maxX:0,minY:0,maxY:0,width:0,height:0}},t.initTransform=function(){var t=this._attrs.attrs||{};t.matrix||(t.matrix=[1,0,0,1,0,0]),this._attrs.attrs=t},t.getMatrix=function(){return this._attrs.attrs.matrix},t.setMatrix=function(t){this._attrs.attrs.matrix=[t[0],t[1],t[2],t[3],t[4],t[5]]},t.transform=function(t){var e=this._attrs.attrs.matrix;return this._attrs.attrs.matrix=bt.transform(e,t),this},t.setTransform=function(t){return this._attrs.attrs.matrix=[1,0,0,1,0,0],this.transform(t)},t.translate=function(t,e){var i=this._attrs.attrs.matrix;bt.translate(i,i,[t,e])},t.rotate=function(t){var e=this._attrs.attrs.matrix;bt.rotate(e,e,t)},t.scale=function(t,e){var i=this._attrs.attrs.matrix;bt.scale(i,i,[t,e])},t.moveTo=function(t,e){var i=this._attrs.x||0,n=this._attrs.y||0;this.translate(t-i,e-n),this.set("x",t),this.set("y",e)},t.apply=function(t){var e=this._attrs.attrs.matrix;return Ct.transformMat2d(t,t,e),this},t.resetTransform=function(t){var e=this._attrs.attrs.matrix;bt.isChanged(e)&&t.transform(e[0],e[1],e[2],e[3],e[4],e[5],!0)},t.isDestroyed=function(){return this.get("destroyed")},e}(),Ji=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){this._attrs={zIndex:0,visible:!0,destroyed:!1,isShape:!0,attrs:{}}},i.getType=function(){return this._attrs.type},i.drawInner=function(t){var e=this.get("attrs");this.createPath(t);var i=t.globalAlpha;if(this.hasFill()){var n=e.fillOpacity;s(n)||1===n?t.fill():(t.globalAlpha=n,t.fill(),t.globalAlpha=i)}if(this.hasStroke()&&e.lineWidth>0){var r=e.strokeOpacity;s(r)||1===r||(t.globalAlpha=r),t.stroke()}},i.getBBox=function(){var t=this._attrs.bbox;return t||((t=this.calculateBox())&&(t.x=t.minX,t.y=t.minY,t.width=t.maxX-t.minX,t.height=t.maxY-t.minY),this._attrs.bbox=t),t},i.calculateBox=function(){return null},i.createPath=function(){},e}(Ui);var $i=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="rect"},i.getDefaultAttrs=function(){return{x:0,y:0,width:0,height:0,radius:0,lineWidth:0}},i.createRadiusPath=function(t,e,i,n,r,a){a=function(t,e,i){if(!((t=ut(t))[0]||t[1]||t[2]||t[3]))return t;var n=Math.max(t[0]+t[1],t[2]+t[3]),r=Math.max(t[0]+t[3],t[1]+t[2]),a=Math.min(e/n,i/r);return a<1?t.map((function(t){return t*a})):t}(a,n,r),t.moveTo(e+a[0],i),t.lineTo(e+n-a[1],i),t.arc(e+n-a[1],i+a[1],a[1],-Math.PI/2,0,!1),t.lineTo(e+n,i+r-a[2]),t.arc(e+n-a[2],i+r-a[2],a[2],0,Math.PI/2,!1),t.lineTo(e+a[3],i+r),t.arc(e+a[3],i+r-a[3],a[3],Math.PI/2,Math.PI,!1),t.lineTo(e,i+a[0]),t.arc(e+a[0],i+a[0],a[0],Math.PI,3*Math.PI/2,!1),t.closePath()},i.createPath=function(t){var e=this.get("attrs"),i=e.x,n=e.y,r=e.width,a=e.height,s=e.radius;t.beginPath(),s&&r*a?this.createRadiusPath(t,i,n,r,a,s):t.rect(i,n,r,a)},i.calculateBox=function(){var t=this.get("attrs"),e=t.x,i=t.y;return{minX:e,minY:i,maxX:e+t.width,maxY:i+t.height}},e}(Ji),Ki=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!1,this._attrs.canStroke=!1,this._attrs.loading=!1,this._attrs.image=null,this._attrs.type="image"},i.createPath=function(t){var e=this,i=this.get("attrs").src;if(!this.get("loading")){var n=this.get("image");if(n)this.drawImage(t,n);else if(i&&Image){this.set("loading",!0);var r=new Image;r.src=i,r.crossOrigin="Anonymous",r.onload=function(){e.set("loading",!1),e.set("image",r),e.drawImage(t,r)}}}},i.drawImage=function(t,e){var i=this._attrs,n=i.attrs;if(!i.destroyed){var r=n.x,a=n.y,o=n.width,h=n.height,u=n.sx,l=n.sy,c=n.swidth,f=n.sheight,g=n.radius;g&&(t.save(),this.createRadiusPath(t,r,a,o,h,g),t.clip()),s(u)||s(l)||s(c)||s(f)?t.drawImage(e,r,a,o,h):t.drawImage(e,u,l,c,f,r,a,o,h),g&&t.restore()}},e}($i),Qi=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="circle"},i.getDefaultAttrs=function(){return{x:0,y:0,r:0,lineWidth:0}},i.createPath=function(t){var e=this.get("attrs"),i=e.x,n=e.y,r=e.r;t.beginPath(),t.arc(i,n,r,0,2*Math.PI,!1),t.closePath()},i.calculateBox=function(){var t=this.get("attrs"),e=t.x,i=t.y,n=t.r;return{minX:e-n,maxX:e+n,minY:i-n,maxY:i+n}},e}(Ji),tn=Ct.create(),en=Ct.create(),nn=Ct.create();function rn(t,e,i,n,r){var a=t*t;return e+(3*-e+t*(3*e-e*t))*t+(3*i+t*(-6*i+3*i*t))*t+(3*n-3*n*t)*a+r*(a*t)}function an(t){for(var e,i,n,r,a,s=1/0,o=-1/0,h=1/0,u=-1/0,l={x:t[0],y:t[1]},c={x:t[2],y:t[3]},f={x:t[4],y:t[5]},g={x:t[6],y:t[7]},p=0;p<100;p++){var d={x:rn(a=p/100,(e=l).x,(i=c).x,(n=f).x,(r=g).x),y:rn(a,e.y,i.y,n.y,r.y)};d.xo&&(o=d.x),d.yu&&(u=d.y)}return{minX:s,minY:h,maxX:o,maxY:u}}function sn(t,e){if(0!==t.length){for(var i=t[0],n=i.x,r=i.x,a=i.y,s=i.y,o=t.length,h=1;h1e-4)return{minX:t-i,minY:e-i,maxX:t+i,maxY:e+i};tn[0]=Math.cos(n)*i+t,tn[1]=Math.sin(n)*i+e,en[0]=Math.cos(r)*i+t,en[1]=Math.sin(r)*i+e;var o=[0,0],h=[0,0];if(Ct.min(o,tn,en),Ct.max(h,tn,en),(n%=2*Math.PI)<0&&(n+=2*Math.PI),(r%=2*Math.PI)<0&&(r+=2*Math.PI),n>r&&!a?r+=2*Math.PI:nn&&(nn[0]=Math.cos(l)*i+t,nn[1]=Math.sin(l)*i+e,Ct.min(o,nn,o),Ct.max(h,nn,h));return{minX:o[0],minY:o[1],maxX:h[0],maxY:h[1]}}var hn=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canStroke=!0,this._attrs.type="line"},i.getDefaultAttrs=function(){return{x1:0,y1:0,x2:0,y2:0,lineWidth:1}},i.createPath=function(t){var e=this.get("attrs"),i=e.x1,n=e.y1,r=e.x2,a=e.y2;t.beginPath(),t.moveTo(i,n),t.lineTo(r,a)},i.calculateBox=function(){var t=this.get("attrs");return function(t,e,i,n,r){return r=r/2||0,{minX:Math.min(t,i)-r,minY:Math.min(e,n)-r,maxX:Math.max(t,i)+r,maxY:Math.max(e,n)+r}}(t.x1,t.y1,t.x2,t.y2,t.lineWidth)},e}(Ji),un=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="polygon"},i.getDefaultAttrs=function(){return{points:null,lineWidth:0}},i.createPath=function(t){var e=this.get("attrs").points;t.beginPath();for(var i=0,n=e.length;in&&(n=h.maxX),h.minYa&&(a=h.maxY)}return{minX:i-(e=e/2||0),minY:r-e,maxX:n+e,maxY:a+e}}(a,n)}return sn(r,n)},e}(Ji),pn=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canStroke=!0,this._attrs.canFill=!0,this._attrs.type="arc"},i.getDefaultAttrs=function(){return{x:0,y:0,r:0,startAngle:0,endAngle:2*Math.PI,anticlockwise:!1,lineWidth:1}},i.createPath=function(t){var e=this.get("attrs"),i=e.x,n=e.y,r=e.r,a=e.startAngle,s=e.endAngle,o=e.anticlockwise;t.beginPath(),a!==s&&t.arc(i,n,r,a,s,o)},i.calculateBox=function(){var t=this.get("attrs");return on(t.x,t.y,t.r,t.startAngle,t.endAngle,t.anticlockwise)},e}(Ji),dn=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="sector"},i.getDefaultAttrs=function(){return{x:0,y:0,lineWidth:0,r:0,r0:0,startAngle:0,endAngle:2*Math.PI,anticlockwise:!1}},i.createPath=function(t){var e=this.get("attrs"),i=e.x,n=e.y,r=e.startAngle,a=e.endAngle,s=e.r,o=e.r0,h=e.anticlockwise;t.beginPath();var u=Math.cos(r),l=Math.sin(r);t.moveTo(u*o+i,l*o+n),t.lineTo(u*s+i,l*s+n),(Math.abs(a-r)>1e-4||0===r&&a<0)&&(t.arc(i,n,s,r,a,h),t.lineTo(Math.cos(a)*o+i,Math.sin(a)*o+n),0!==o&&t.arc(i,n,o,a,r,!h)),t.closePath()},i.calculateBox=function(){var t=this.get("attrs"),e=t.x,i=t.y,n=t.r,r=t.r0,a=t.startAngle,s=t.endAngle,o=t.anticlockwise,h=on(e,i,n,a,s,o),u=on(e,i,r,a,s,o);return{minX:Math.min(h.minX,u.minX),minY:Math.min(h.minY,u.minY),maxX:Math.max(h.maxX,u.maxX),maxY:Math.max(h.maxY,u.maxY)}},e}(Ji),vn=function(t){var e=t.width,i=t.height,n=t.rotate,r=Math.abs(n);return{width:Math.abs(e*Math.cos(r)+i*Math.sin(r)),height:Math.abs(i*Math.cos(r)+e*Math.sin(r))}},yn=0,mn={},xn=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="text"},i.getDefaultAttrs=function(){return{lineWidth:0,lineCount:1,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom",lineHeight:null,textArr:null}},i._getFontStyle=function(){var t=this._attrs.attrs,e=t.fontSize,i=t.fontFamily,n=t.fontWeight;return t.fontStyle+" "+t.fontVariant+" "+n+" "+e+"px "+i},i._afterAttrsSet=function(){var t=this._attrs.attrs;if(t.font=this._getFontStyle(),t.text){var e=t.text,i=null,n=1;g(e)&&-1!==e.indexOf("\n")&&(n=(i=e.split("\n")).length),t.lineCount=n,t.textArr=i}this.set("attrs",t)},i._getTextHeight=function(){var t=this._attrs.attrs;if(t.height)return t.height;var e=t.lineCount,i=1*t.fontSize;return e>1?i*e+this._getSpaceingY()*(e-1):i},i._getSpaceingY=function(){var t=this._attrs.attrs,e=t.lineHeight,i=1*t.fontSize;return e?e-i:.14*i},i.drawInner=function(t){var e=this._attrs.attrs,i=e.text,n=e.x,r=e.y;if(!(s(i)||isNaN(n)||isNaN(r))){var a=e.textArr,o=1*e.fontSize,h=this._getSpaceingY();e.rotate&&(t.translate(n,r),t.rotate(e.rotate),n=0,r=0);var u,l,c=e.textBaseline;if(a&&(u=this._getTextHeight()),this.hasFill()){var f=e.fillOpacity;if(s(f)||1===f||(t.globalAlpha=f),a)for(var g=0,p=a.length;g5e3&&(yn=0,mn={}),yn++,mn[a]=o,o}},e}(Ji),_n=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.createPath=null,this._attrs.type="custom"},i.createPath=function(t){var e=this.get("createPath");e&&e.call(this,t)},i.calculateBox=function(){var t=this.get("calculateBox");return t&&t.call(this)},e}(Ji),Sn={circle:function(t,e,i,n){n.arc(t,e,i,0,2*Math.PI,!1)},square:function(t,e,i,n){n.moveTo(t-i,e-i),n.lineTo(t+i,e-i),n.lineTo(t+i,e+i),n.lineTo(t-i,e+i),n.closePath()}},Mn=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initProperties=function(){t.prototype._initProperties.call(this),this._attrs.canFill=!0,this._attrs.canStroke=!0,this._attrs.type="marker"},i.getDefaultAttrs=function(){return{x:0,y:0,lineWidth:0}},i.createPath=function(t){var e,i=this.get("attrs"),n=i.x,r=i.y,s=i.radius,o=i.symbol||"circle";e=a(o)?o:Sn[o],t.beginPath(),e(n,r,s,t,this)},i.calculateBox=function(){var t=this.get("attrs"),e=t.x,i=t.y,n=t.radius;return{minX:e-n,minY:i-n,maxX:e+n,maxY:i+n}},e}(Ji);Ji.Rect=$i,Ji.Image=Ki,Ji.Circle=Qi,Ji.Line=hn,Ji.Polygon=un,Ji.Polyline=gn,Ji.Arc=pn,Ji.Sector=dn,Ji.Text=xn,Ji.Custom=_n,Ji.Marker=Mn;var wn={};var bn={getGroupClass:function(){},getChildren:function(){return this.get("children")},addShape:function(t,e){void 0===e&&(e={});var i=wn[t];i||(i=M(t),wn[t]=i);var n=new Ji[i](e);return this.add(n),n},addGroup:function(t){var e=new(this.getGroupClass())(t);return this.add(e),e},contain:function(t){return this.get("children").indexOf(t)>-1},sort:function(){for(var t=this.get("children"),e=0,i=t.length;e=r.x&&i<=a.x&&n>=r.y&&n<=s.y}var En=Object.freeze({__proto__:null,getClip:Yn,isPointInPlot:On});function Nn(t,e){return t-e}var Fn=function(t){xt(i,t),i.initPlugins=function(){return{_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach((function(t){-1===e.indexOf(t)&&e.push(t)})),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach((function(t){var i=e.indexOf(t);-1!==i&&e.splice(i,1)})),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,i){var n,r,a,s,o=this.descriptors(t),h=o.length;for(n=0;n0;){t.shift().destroy()}},e._clearGeoms=function(){for(var t=this.get("geoms"),e=0,i=t.length;e=0&&(e.lineWidth=t.size),T(e,t.style),T({},vt.shape.line,e)}(e);return"dash"===t&&(r.lineDash=vt.lineDash),function(t,e,i,n){var r=t.points;if(r.length&&o(r[0].y)){for(var a=[],s=[],h=0,u=r.length;h1?vt.widthRatio.multiplePie:vt.widthRatio.rose:(i.isLinear&&(s*=a[1]-a[0]),o=vt.widthRatio.column),s*=o,this.hasAdjust("dodge")&&(s/=n.length),t=s,this.set("defaultSize",t)}return t},getDimWidth:function(t){var e=this.get("coord"),i=e.convertPoint({x:0,y:0}),n=e.convertPoint({x:"x"===t?1:0,y:"x"===t?0:1}),r=0;return i&&n&&(r=Math.sqrt(Math.pow(n.x-i.x,2)+Math.pow(n.y-i.y,2))),r},_getWidth:function(){var t=this.get("_width");if(!t){var e=this.get("coord");t=e&&e.isPolar&&!e.transposed?(e.endAngle-e.startAngle)*e.circleRadius:this.getDimWidth("x"),this.set("_width",t)}return t},_toNormalizedSize:function(t){return t/this._getWidth()},_toCoordSize:function(t){return this._getWidth()*t},getNormalizedSize:function(t){var e=this.getAttrValue("size",t);return e=s(e)?this.getDefaultSize():this._toNormalizedSize(e)},getSize:function(t){var e=this.getAttrValue("size",t);if(s(e)){var i=this.getDefaultSize();e=this._toCoordSize(i)}return e}};function Jn(t){var e,i,n=t.x,r=t.y,a=t.y0,s=t.size,h=a,u=r;return o(r)&&(u=r[1],h=r[0]),o(n)?(e=n[0],i=n[1]):(e=n-s/2,i=n+s/2),[{x:e,y:h},{x:e,y:u},{x:i,y:u},{x:i,y:h}]}jt.registerFactory("interval",{defaultShapeType:"rect",getDefaultPoints:function(t){return Jn(t)}});jt.registerShape("interval","rect",{draw:function(t,e){var i=this.parsePoints(t.points),n=T({fill:t.color},vt.shape.interval,t.style);if(t.isInCircle){var r=i.slice(0);this._coord.transposed&&(r=[i[0],i[3],i[2],i[1]]);var a=t.center,s=a.x,o=a.y,h=[1,0],u=[r[0].x-s,r[0].y-o],l=[r[1].x-s,r[1].y-o],c=[r[2].x-s,r[2].y-o],f=Ct.angleTo(h,l),g=Ct.angleTo(h,c),p=Ct.length(u),d=Ct.length(l);return f>=1.5*Math.PI&&(f-=2*Math.PI),g>=1.5*Math.PI&&(g-=2*Math.PI),e.addShape("Sector",{className:"interval",attrs:T({x:s,y:o,r:d,r0:p,startAngle:f,endAngle:g},n)})}var v=function(t){for(var e=[],i=[],n=0,r=t.length;n=0?"positive":"negative";r[g][f]||(r[g][f]=0),u[i]=[r[g][f],c+r[g][f]],r[g][f]+=c}}},n}(Vt);Vt.Stack=rr;var ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sr=function(t){var e=void 0===t?"undefined":ar(t);return null!==t&&"object"===e||"function"===e},or=function(t,e){if(t){if(ir(t))for(var i=0,n=t.length;in&&(i=t,n=r)})),i}};var cr={merge:function(t){for(var e=[],i=0;i0&&h<=1&&(n*=h),this.x={start:this.startAngle,end:this.endAngle},this.y={start:n*a,end:n},this.center=r,this.circleRadius=n},i._convertPoint=function(t){var e=this.center,i=this.transposed,n=i?"y":"x",r=i?"x":"y",a=this.x,s=this.y,o=a.start+(a.end-a.start)*t[n],h=s.start+(s.end-s.start)*t[r];return{x:e.x+Math.cos(o)*h,y:e.y+Math.sin(o)*h}},i._invertPoint=function(t){var e=this.center,i=this.transposed,n=this.x,r=this.y,a=i?"y":"x",s=i?"x":"y",o=[1,0,0,1,0,0];bt.rotate(o,o,n.start);var h=[1,0];Ct.transformMat2d(h,h,o),h=[h[0],h[1]];var u=[t.x-e.x,t.y-e.y];if(Ct.zero(u))return{x:0,y:0};var l=Ct.angleTo(h,u,n.end0?f:-f;var g=(c-r.start)/(r.end-r.start),p={};return p[a]=f,p[s]=g,p},e}(kt);kt.Polar=gr;var pr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){t.prototype._initDefaultCfg.call(this),this.startAngle=-Math.PI/2,this.endAngle=3*Math.PI/2,this.radius=null,this.center=null},i.getOffsetPoint=function(t){var e=this.startAngle,i=e+(this.endAngle-e)*t;return this._getCirclePoint(i)},i._getCirclePoint=function(t,e){var i=this.center;return e=e||this.radius,{x:i.x+Math.cos(t)*e,y:i.y+Math.sin(t)*e}},i.getTextAlignInfo=function(t,e){var i,n=this.getOffsetVector(t,e),r="middle";return n[0]>0?i="left":n[0]<0?i="right":(i="center",n[1]>0?r="top":n[1]<0&&(r="bottom")),{textAlign:i,textBaseline:r}},i.getAxisVector=function(t){var e=this.center,i=this.offsetFactor;return[(t.y-e.y)*i,-1*(t.x-e.x)*i]},i.drawLine=function(t){var e=this.center,i=this.radius,n=this.startAngle,r=this.endAngle;this.getContainer(t.top).addShape("arc",{className:"axis-line",attrs:T({x:e.x,y:e.y,r:i,startAngle:n,endAngle:r},t)})},e}(Fi);Fi.Circle=pr;var dr={min:0,median:.5,max:1},vr=function(){var t=e.prototype;function e(t){this._initDefaultCfg(),A(this,t)}return t._initDefaultCfg=function(){},t._getNormalizedValue=function(t,e){return s(dr[t])?e.scale(t):dr[t]},t.parsePercentPoint=function(t,e){var i=parseFloat(e[0])/100,n=parseFloat(e[1])/100,r=t.start,a=t.end,s=Math.abs(r.x-a.x),o=Math.abs(r.y-a.y);return{x:s*i+Math.min(r.x,a.x),y:o*n+Math.min(r.y,a.y)}},t.parsePoint=function(t,e){var i=this.xScale,n=this.yScales;if(a(e)&&(e=e(i,n)),g(e[0])&&-1!==e[0].indexOf("%")&&!isNaN(e[0].slice(0,-1)))return this.parsePercentPoint(t,e);var r=this._getNormalizedValue(e[0],i),s=this._getNormalizedValue(e[1],n[0]),o=t.convertPoint({x:r,y:s});return this.limitInPlot?r>=0&&r<=1&&s>=0&&s<=1?o:null:o},t.render=function(){},t.repaint=function(){this.remove();var t=this.coord,e=this.container,i=this.canvas;e&&!e.isDestroyed()&&(this.render(t,e),i.draw())},t.remove=function(){var t=this.element;t&&t.remove(!0)},t.changeVisible=function(t){this.visible=t;var e=this.element;e&&(e.set?e.set("visible",t):e.style.display=t?"":"none")},e}(),yr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="arc",this.start=[],this.end=[],this.style={stroke:"#999",lineWidth:1}},i.render=function(t,e){var i=this.parsePoint(t,this.start),n=this.parsePoint(t,this.end);if(i&&n){var r=t.center,a=Math.sqrt((i.x-r.x)*(i.x-r.x)+(i.y-r.y)*(i.y-r.y)),s=Math.atan2(i.y-r.y,i.x-r.x),o=Math.atan2(n.y-r.y,n.x-r.x),h=e.addShape("arc",{className:"guide-arc",attrs:T({x:r.x,y:r.y,r:a,startAngle:s,endAngle:o},this.style)});return this.element=h,h}},e}(vr);function mr(t,e){for(var i in e)e.hasOwnProperty(i)&&(t.style[i]=e[i]);return t}function xr(t){var e=document.createElement("div");return t=t.replace(/(^\s*)|(\s*$)/g,""),e.innerHTML=""+t,e.childNodes[0]}vr.Arc=yr;var _r=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="html",this.position=null,this.alignX="center",this.alignY="middle",this.offsetX=null,this.offsetY=null,this.html=null},i.render=function(t,e){var i=this.parsePoint(t,this.position);if(i){var n=xr(this.html);n=mr(n,{position:"absolute",top:Math.floor(i.y)+"px",left:Math.floor(i.x)+"px",visibility:"hidden"});var r=e.get("canvas").get("el"),a=r.parentNode;a=mr(a,{position:"relative"});var s=xr('
');a.appendChild(s),s.appendChild(n);var o=r.offsetTop,h=r.offsetLeft,u=this.alignX,l=this.alignY,c=this.offsetX,f=this.offsetY,g=function(t,e,i,n){var r=[];return"left"===t&&"top"===e?(r[0]=0,r[1]=0):"right"===t&&"top"===e?(r[0]=-i,r[1]=0):"left"===t&&"bottom"===e?(r[0]=0,r[1]=Math.floor(-n)):"right"===t&&"bottom"===e?(r[0]=Math.floor(-i),r[1]=Math.floor(-n)):"right"===t&&"middle"===e?(r[0]=Math.floor(-i),r[1]=Math.floor(-n/2)):"left"===t&&"middle"===e?(r[0]=0,r[1]=Math.floor(-n/2)):"center"===t&&"bottom"===e?(r[0]=Math.floor(-i/2),r[1]=Math.floor(-n)):"center"===t&&"top"===e?(r[0]=Math.floor(-i/2),r[1]=0):(r[0]=Math.floor(-i/2),r[1]=Math.floor(-n/2)),r}(u,l,Q(n),tt(n));i.x=i.x+g[0]+h,i.y=i.y+g[1]+o,c&&(i.x+=c),f&&(i.y+=f),mr(n,{top:Math.floor(i.y)+"px",left:Math.floor(i.x)+"px",visibility:"visible"}),this.element=s}},i.remove=function(){var t=this.element;t&&t.parentNode&&t.parentNode.removeChild(t)},e}(vr);vr.Html=_r;var Sr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="line",this.start=[],this.end=[],this.style={stroke:"#000",lineWidth:1}},i.render=function(t,e){var i=[];if(i[0]=this.parsePoint(t,this.start),i[1]=this.parsePoint(t,this.end),i[0]&&i[1]){var n=e.addShape("Line",{className:"guide-line",attrs:T({x1:i[0].x,y1:i[0].y,x2:i[1].x,y2:i[1].y},this.style)});return this.element=n,n}},e}(vr);vr.Line=Sr;var Mr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="rect",this.start=[],this.end=[],this.style={fill:"#CCD7EB",opacity:.4}},i.render=function(t,e){var i=this.parsePoint(t,this.start),n=this.parsePoint(t,this.end);if(i&&n){var r=e.addShape("rect",{className:"guide-rect",attrs:T({x:Math.min(i.x,n.x),y:Math.min(i.y,n.y),width:Math.abs(n.x-i.x),height:Math.abs(i.y-n.y)},this.style)});return this.element=r,r}},e}(vr);vr.Rect=Mr;var wr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="text",this.position=null,this.content=null,this.style={fill:"#000"},this.offsetX=0,this.offsetY=0},i.render=function(t,e){var i=this.position,n=this.parsePoint(t,i);if(n){var r=this.content,a=this.style,s=this.offsetX,o=this.offsetY;s&&(n.x+=s),o&&(n.y+=o);var h=e.addShape("text",{className:"guide-text",attrs:T({x:n.x,y:n.y,text:r},a)});return this.element=h,h}},e}(vr);vr.Text=wr;var br=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="tag",this.position=null,this.content=null,this.direct="tl",this.autoAdjust=!0,this.offsetX=0,this.offsetY=0,this.side=4,this.background={padding:5,radius:2,fill:"#1890FF"},this.textStyle={fontSize:12,fill:"#fff",textAlign:"center",textBaseline:"middle"},this.withPoint=!0,this.pointStyle={fill:"#1890FF",r:3,lineWidth:1,stroke:"#fff"}},i._getDirect=function(t,e,i,n){var r=this.direct,a=this.side,s=t.get("canvas"),o=s.get("width"),h=s.get("height"),u=e.x,l=e.y,c=r[0],f=r[1];"t"===c&&l-a-n<0?c="b":"b"===c&&l+a+n>h&&(c="t");var g="c"===c?a:0;return"l"===f&&u-g-i<0?f="r":"r"===f&&u+g+i>o?f="l":"c"===f&&(i/2+u+g>o?f="l":u-i/2-g<0&&(f="r")),r=c+f},i.render=function(t,e){var i=this.parsePoint(t,this.position);if(i&&!isNaN(i.x)&&!isNaN(i.y)){var n=this.content,r=this.background,a=this.textStyle,s=[],o=e.addGroup({className:"guide-tag"});if(this.withPoint){var h=o.addShape("Circle",{className:"guide-tag-point",attrs:T({x:i.x,y:i.y},this.pointStyle)});s.push(h)}var u=o.addGroup(),l=u.addShape("text",{className:"guide-tag-text",zIndex:1,attrs:T({x:0,y:0,text:n},a)});s.push(l);var c=l.getBBox(),f=ut(r.padding),g=c.width+f[1]+f[3],p=c.height+f[0]+f[2],d=c.minY-f[0],v=c.minX-f[3],y=u.addShape("rect",{className:"guide-tag-bg",zIndex:-1,attrs:T({x:v,y:d,width:g,height:p},r)});s.push(y);var m,x=this.autoAdjust?this._getDirect(e,i,g,p):this.direct,_=this.side,S=i.x+this.offsetX,M=i.y+this.offsetY,w=ut(r.radius);"tl"===x?(m=[{x:g+v-_-1,y:p+d-1},{x:g+v,y:p+d-1},{x:g+v,y:p+_+d}],w[2]=0,S-=g,M=M-_-p):"cl"===x?(m=[{x:g+v-1,y:(p-_)/2+d-1},{x:g+v-1,y:(p+_)/2+d+1},{x:g+_+v,y:p/2+d}],S=S-g-_,M-=p/2):"bl"===x?(m=[{x:g+v,y:-_+d},{x:g+v-_-1,y:d+1},{x:g+v,y:d+1}],w[1]=0,S-=g,M+=_):"bc"===x?(m=[{x:g/2+v,y:-_+d},{x:(g-_)/2+v-1,y:d+1},{x:(g+_)/2+v+1,y:d+1}],S-=g/2,M+=_):"br"===x?(m=[{x:v,y:d-_},{x:v,y:d+1},{x:v+_+1,y:d+1}],w[0]=0,M+=_):"cr"===x?(m=[{x:v-_,y:p/2+d},{x:v+1,y:(p-_)/2+d-1},{x:v+1,y:(p+_)/2+d+1}],S+=_,M-=p/2):"tr"===x?(m=[{x:v,y:p+_+d},{x:v,y:p+d-1},{x:_+v+1,y:p+d-1}],w[3]=0,M=M-p-_):"tc"===x&&(m=[{x:(g-_)/2+v-1,y:p+d-1},{x:(g+_)/2+v+1,y:p+d-1},{x:g/2+v,y:p+_+d}],S-=g/2,M=M-p-_);var b=u.addShape("Polygon",{className:"guide-tag-side",zIndex:0,attrs:{points:m,fill:r.fill}});return s.push(b),y.attr("radius",w),u.moveTo(S-v,M-d),u.sort(),this.element=o,s}},e}(vr);vr.Tag=br;var Cr=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i._initDefaultCfg=function(){this.type="point",this.position=null,this.offsetX=0,this.offsetY=0,this.style={fill:"#1890FF",r:3,lineWidth:1,stroke:"#fff"}},i.render=function(t,e){var i=this.parsePoint(t,this.position);if(!i)return null;var n=e.addShape("Circle",{className:"guide-point",attrs:T({x:i.x+this.offsetX,y:i.y+this.offsetY},this.style)});return this.element=n,n},e}(vr);vr.Point=Cr;var Pr=function(){var t=e.prototype;function e(t){A(this,this.getDefaultCfg(),t),this._init(),this._renderTitle(),this._renderItems()}return t.getDefaultCfg=function(){return{showTitle:!1,title:null,items:null,titleGap:12,itemGap:10,itemMarginBottom:12,itemFormatter:null,itemWidth:null,wordSpace:6,x:0,y:0,layout:"horizontal",joinString:": "}},t._init=function(){var t=this.parent;if(t){var e=t.addGroup({zIndex:this.zIndex||0});this.container=e;var i=e.addGroup();this.wrapper=i;var n=i.addGroup({className:"itemsGroup"});this.itemsGroup=n}},t._renderTitle=function(t){t=t||this.title;var e=this.titleShape,i=0;if(this.showTitle&&t){if(e&&!e.get("destroyed"))e.attr("text",t);else{var n=this.wrapper,r=this.titleStyle;e=n.addShape("text",{className:"title",attrs:T({x:0,y:0,text:t},r)}),this.titleShape=e}i=e.getBBox().height+this.titleGap}this._titleHeight=i},t._renderItems=function(t){var e=this;(t=t||e.items)&&(e.reversed&&t.reverse(),u(t,(function(t,i){e._addItem(t,i)})),t.length>1&&this._adjustItems(),this._renderBackground())},t._renderBackground=function(){var t=this.background;if(t){var e=this.container,i=this.wrapper.getBBox(),n=i.minX,r=i.minY,a=i.width,s=i.height,o=t.padding||[0,0,0,0],h=T({x:n-(o=ut(o))[3],y:r-o[0],width:a+o[1]+o[3],height:s+o[0]+o[2]},t),u=this.backShape;u?u.attr(h):u=e.addShape("Rect",{zIndex:-1,attrs:h}),this.backShape=u,e.sort()}},t._addItem=function(t){var e,i=this.itemsGroup.addGroup({name:t.name,value:t.value,dataValue:t.dataValue,checked:t.checked}),n=this.unCheckStyle,r=this.unCheckColor,a=this.nameStyle,s=this.valueStyle,o=this.wordSpace,h=t.marker,u=t.value,l=0;if(r&&(n.fill=r),h){var c=T({x:h.radius||3,y:this._titleHeight},h);!1===t.checked&&T(c,n),l+=i.addShape("marker",{className:"item-marker",attrs:c}).getBBox().width+o}var f=t.name;if(f){var g=this.joinString||"";f=u?f+g:f,e=i.addShape("text",{className:"name",attrs:T({x:l,y:this._titleHeight,text:this._formatItemValue(f)},a,!1===t.checked?n:null)})}if(u){var p=l;e&&(p+=e.getBBox().width),i.addShape("text",{className:"value",attrs:T({x:p,y:this._titleHeight,text:u},s,!1===t.checked?n:null)})}return i},t._formatItemValue=function(t){var e=this.itemFormatter;return e&&(t=e.call(this,t)),t},t._getMaxItemWidth=function(){var t=this.itemWidth;if(m(t)||s(t))return t;if("auto"===t){for(var e=this.itemsGroup.get("children"),i=e.length,n=0,r=0;r1e-4&&(o++,h=0),g.moveTo(h,o*e),l.push({x:h,y:o*e+s-d/2,width:1.375*v,height:1.375*d}),h+=t+r}this.legendHitBoxes=l},t._adjustVertical=function(){for(var t,e,i=this.maxLength,n=this.itemsGroup,r=this.itemGap,a=this.itemMarginBottom,s=this.itemWidth,o=this._titleHeight,h=n.get("children"),u=0,l=0,c=0,f=[],g=0,p=h.length;gl&&(l=t+r),i-u=e.br.y&&(o=e.br.y-r),s<0&&(s=e.tl.x,i&&i.attr("x1",e.tl.x+a)),n.updatePosition(s,o)}},t.setXTipContent=function(t){var e=this.xTip;t=a(e)?e(t):T({text:t},e),this.xTipBox&&this.xTipBox.updateContent(t)},t.setXTipPosition=function(t){var e=this.showXTip,i=this.canvas,n=this.plotRange,r=this.xTipBox,a=this.crosshairsShapeY;if(e){var s=i.get("height"),o=r.getWidth(),h=r.getHeight(),u=t-o/2,l=n.br.y;u<=n.tl.x&&(u=n.tl.x),u+o>=n.tr.x&&(u=n.tr.x-o),s-l1?(t[0].x+t[t.length-1].x)/2:t[0].x)-c/2+n)p.x&&(d=p.x-c),s){var y=v+f;s.attr("points",[{x:o-3,y:y},{x:o+3,y:y},{x:o,y:y+4}]);var m=e.backShape,x=ut(m.attr("radius"));o===g.x?(x[3]=0,s.attr("points",[{x:g.x,y:y},{x:g.x+4,y:y},{x:g.x,y:y+4}])):o===p.x&&(x[2]=0,s.attr("points",[{x:p.x-4,y:y},{x:p.x,y:y},{x:p.x,y:y+4}])),m.attr("radius",x)}e.moveTo(d-u,v-l)}},t.setMarkers=function(t){void 0===t&&(t={});var e=t,i=e.items,n=e.style,r=e.type,a=this._getMarkerGroup(r);if("circle"===r)for(var s=0,o=i.length;s16&&(e.showTooltip(r),e.timeStamp=s)}else e.hideTooltip()}})),yt(this,"handleHideEvent",(function(){e.enable&&e.hideTooltip()})),this.enable=!0,this.cfg={},this.tooltip=null,this.chart=null,this.timeStamp=0,T(this,t);var i=this.chart.get("canvas");this.canvas=i,this.canvasDom=i.get("el")}var e=t.prototype;return e._setCrosshairsCfg=function(){var t=this.chart,e=T({},vt.tooltip),i=t.get("geoms"),n=[];u(i,(function(t){var e=t.get("type");-1===n.indexOf(e)&&n.push(e)}));var r=t.get("coord").type;return!i.length||"cartesian"!==r&&"rect"!==r||1===n.length&&-1!==["line","area","path","point"].indexOf(n[0])&&T(e,{showCrosshairs:!0}),e},e._getMaxLength=function(t){void 0===t&&(t={});var e=t,i=e.layout,n=e.plotRange;return"horizontal"===i?n.br.x-n.bl.x:n.bl.y-n.tr.y},e.render=function(){if(!this.tooltip){var t=this.chart,e=t.get("canvas"),i=t.get("frontPlot").addGroup({className:"tooltipContainer",zIndex:10}),n=t.get("backPlot").addGroup({className:"tooltipContainer"}),r=t.get("plotRange"),a=t.get("coord"),s=this._setCrosshairsCfg(),o=this.cfg,h=A({plotRange:r,frontPlot:i,backPlot:n,canvas:e,fixed:a.transposed||a.isPolar},s,o);h.maxLength=this._getMaxLength(h),this._tooltipCfg=h;var u=new Tr(h);this.tooltip=u,h.alwaysShow&&this.prePoint&&this.showTooltip(this.prePoint),this.bindEvents()}},e.clear=function(){var t=this.tooltip;t&&(t.destroy(),this.unBindEvents()),this.tooltip=null,this._lastActive=null},e._getTooltipMarkerStyle=function(t){void 0===t&&(t={});var e=t,i=e.type,n=e.items,r=this._tooltipCfg;if("rect"===i){var a,s,o,h,u=this.chart,l=u.get("plotRange"),c=l.tl,f=l.br,g=u.get("coord"),p=n[0],d=n[n.length-1],v=p.width;g.transposed?(a=c.x,s=d.y-.75*v,o=f.x-c.x,h=p.y-d.y+1.5*v):(a=p.x-.75*v,s=c.y,o=d.x-p.x+1.5*v,h=f.y-c.y),t.style=T({x:a,y:s,width:o,height:h,fill:"#CCD6EC",opacity:.3},r.tooltipMarkerStyle)}else t.style=T({radius:4,fill:"#fff",lineWidth:2},r.tooltipMarkerStyle);return t},e._setTooltip=function(t,e,i){void 0===i&&(i={}),this.prePoint=t;var n=this._lastActive,r=this.tooltip,a=this._tooltipCfg;e=Or(e);var s=this.chart,o=s.get("coord"),h=s.getYScales()[0],u=a.snap;if(!1===u&&h.isLinear){var l,c,f=o.invertPoint(t);On(t,s.get("plotRange"))&&(o.transposed?(l=h.invert(f.x),c=t.x,r.setXTipContent(l),r.setXTipPosition(c),r.setYCrosshairPosition(c)):(l=h.invert(f.y),c=t.y,r.setYTipContent(l),r.setYTipPosition(c),r.setXCrosshairPosition(c)))}if(a.onShow&&a.onShow({x:t.x,y:t.y,tooltip:r,items:e,tooltipMarkerCfg:i}),g=n,p=e,JSON.stringify(g)!==JSON.stringify(p)){var g,p;this._lastActive=e;var d=a.onChange;d&&d({x:t.x,y:t.y,tooltip:r,items:e,tooltipMarkerCfg:i});var v=e[0],y=v.title||v.name,m=v.x;if(e.length>1&&(m=(e[0].x+e[e.length-1].x)/2),r.setContent(y,e,o.transposed),r.setPosition(e,t),o.transposed){var x=v.y;e.length>1&&(x=(e[0].y+e[e.length-1].y)/2),r.setYTipContent(y),r.setYTipPosition(x),r.setXCrosshairPosition(x),u&&(r.setXTipContent(v.value),r.setXTipPosition(m),r.setYCrosshairPosition(m))}else r.setXTipContent(y),r.setXTipPosition(m),r.setYCrosshairPosition(m),u&&(r.setYTipContent(v.value),r.setYTipPosition(v.y),r.setXCrosshairPosition(v.y));var _=i.items;a.showTooltipMarker&&_.length?(i=this._getTooltipMarkerStyle(i),r.setMarkers(i)):r.clearMarkers(),r.show()}else{!1===u&&(lt(a.crosshairsType,"y")||a.showYTip)&&this.chart.get("canvas").draw()}},e.showTooltip=function(t){var e,i,n=this.chart,r=[],a=[],s=this._tooltipCfg,h=s.showItemMarker,l=s.itemMarkerStyle,c=s.alwaysShow;h&&(i=l);var f=n.get("geoms"),g=n.get("coord");if(u(f,(function(n){if(n.get("visible")){var s=n.get("type"),h=n.getSnapRecords(t),l=n.get("adjust");if("interval"===s&&l&&"symmetric"===l.type)return;u(h,(function(t){var h=t.x,u=t.y,l=t._origin,c=t.color;if((h||!isNaN(h))&&(u||!isNaN(u))){var f={x:h,y:o(u)?u[1]:u,color:c||vt.defaultColor,origin:l,name:Ar(n,l),value:Ir(n,l),title:Yr(n,l)};i&&(f.marker=T({fill:c||vt.defaultColor},i)),a.push(f),-1!==["line","area","path"].indexOf(s)?(e="circle",r.push(f)):"interval"!==s||"cartesian"!==g.type&&"rect"!==g.type||(e="rect",f.width=n.getSize(t._origin),r.push(f))}}))}})),a.length){var p={items:r,type:e};this._setTooltip(t,a,p)}else c||this.hideTooltip()},e.hideTooltip=function(){var t=this._tooltipCfg;this._lastActive=null;var e=this.tooltip;e&&(e.hide(),t.onHide&&t.onHide({tooltip:e}),this.chart.get("canvas").draw())},e._handleEvent=function(t,e,i){var n=this.canvas;u([].concat(t),(function(t){"bind"===i?n.on(t,e):n.off(t,e)}))},e.bindEvents=function(){var t=this._tooltipCfg,e=t.triggerOn,i=t.triggerOff,n=t.alwaysShow;e&&this._handleEvent(e,this.handleShowEvent,"bind"),n||this._handleEvent(i,this.handleHideEvent,"bind")},e.unBindEvents=function(){var t=this._tooltipCfg,e=t.triggerOn,i=t.triggerOff,n=t.alwaysShow;e&&this._handleEvent(e,this.handleShowEvent,"unBind"),n||this._handleEvent(i,this.handleHideEvent,"unBind")},t}();function Nr(t){var e=new Er({chart:t});t.set("tooltipController",e),t.tooltip=function(t,i){return h(t)&&(i=t,t=!0),e.enable=t,i&&(e.cfg=i),this}}function Fr(t){var e=t.get("tooltipController");e.render(),t.showTooltip=function(t){return e.showTooltip(t),this},t.hideTooltip=function(){return e.hideTooltip(),this}}function zr(t){t.get("tooltipController").clear()}var Br={init:Nr,afterGeomDraw:Fr,clearInner:zr},Xr=Object.freeze({__proto__:null,init:Nr,afterGeomDraw:Fr,clearInner:zr,default:Br});vt.guide=A({line:{style:{stroke:"#a3a3a3",lineWidth:1},top:!0},text:{style:{fill:"#787878",textAlign:"center",textBaseline:"middle"},offsetX:0,offsetY:0,top:!0},rect:{style:{fill:"#fafafa"},top:!1},arc:{style:{stroke:"#a3a3a3"},top:!0},html:{offsetX:0,offsetY:0,alignX:"center",alignY:"middle"},tag:{top:!0,offsetX:0,offsetY:0,side:4,background:{padding:5,radius:2,fill:"#1890FF"},textStyle:{fontSize:12,fill:"#fff",textAlign:"center",textBaseline:"middle"}},point:{top:!0,offsetX:0,offsetY:0,style:{fill:"#fff",r:3,lineWidth:2,stroke:"#1890ff"}}},vt.guide||{});var Lr=function(){function t(t){this.guides=[],this.xScale=null,this.yScales=null,this.guideShapes=[],T(this,t)}var e=t.prototype;return e._toString=function(t){return a(t)&&(t=t(this.xScale,this.yScales)),t=t.toString()},e._getId=function(t,e){var i=e.id;if(!i){var n=e.type;i="arc"===n||"line"===n||"rect"===n?this._toString(e.start)+"-"+this._toString(e.end):this._toString(e.position)}return i},e.paint=function(t){var e=this,i=e.chart,n=e.guides,r=e.xScale,a=e.yScales,s=[];u(n,(function(n,o){var h;n.xScale=r,n.yScales=a,"regionFilter"===n.type?n.chart=i:h=n.top?e.frontPlot:e.backPlot,n.coord=t,n.container=h,n.canvas=i.get("canvas");var u=n.render(t,h);if(u){var l=e._getId(u,n);[].concat(u).forEach((function(t){t._id=t.get("className")+"-"+l,t.set("index",o),s.push(t)}))}})),e.guideShapes=s},e.clear=function(){return this.reset(),this.guides=[],this},e.reset=function(){u(this.guides,(function(t){t.remove()}))},e._createGuide=function(t,e){var i=M(t),n=new vr[i](A({},vt.guide[t],e));return this.guides.push(n),n},e.line=function(t){return void 0===t&&(t={}),this._createGuide("line",t)},e.text=function(t){return void 0===t&&(t={}),this._createGuide("text",t)},e.arc=function(t){return void 0===t&&(t={}),this._createGuide("arc",t)},e.html=function(t){return void 0===t&&(t={}),this._createGuide("html",t)},e.rect=function(t){return void 0===t&&(t={}),this._createGuide("rect",t)},e.tag=function(t){return void 0===t&&(t={}),this._createGuide("tag",t)},e.point=function(t){return void 0===t&&(t={}),this._createGuide("point",t)},e.regionFilter=function(t){return void 0===t&&(t={}),this._createGuide("regionFilter",t)},t}();function jr(t){var e=new Lr({frontPlot:t.get("frontPlot").addGroup({zIndex:20,className:"guideContainer"}),backPlot:t.get("backPlot").addGroup({className:"guideContainer"})});t.set("guideController",e),t.guide=function(){return e}}function Gr(t){var e=t.get("guideController");if(e.guides.length){var i=t.getXScale(),n=t.getYScales(),r=t.get("coord");e.xScale=i,e.yScales=n,e.chart=t,e.paint(r)}}function Rr(t){t.get("guideController").clear()}function Hr(t){t.get("guideController").reset()}var Wr={init:jr,afterGeomDraw:Gr,clear:Rr,repaint:Hr},Vr=Object.freeze({__proto__:null,init:jr,afterGeomDraw:Gr,clear:Rr,repaint:Hr,default:Wr}),qr={itemMarginBottom:12,itemGap:10,showTitle:!1,titleStyle:{fontSize:12,fill:"#808080",textAlign:"start",textBaseline:"top"},nameStyle:{fill:"#808080",fontSize:12,textAlign:"start",textBaseline:"middle"},valueStyle:{fill:"#000000",fontSize:12,textAlign:"start",textBaseline:"middle"},unCheckStyle:{fill:"#bfbfbf"},itemWidth:"auto",wordSpace:6,selectedMode:"multiple"};vt.legend=A({common:qr,right:T({position:"right",layout:"vertical"},qr),left:T({position:"left",layout:"vertical"},qr),top:T({position:"top",layout:"horizontal"},qr),bottom:T({position:"bottom",layout:"horizontal"},qr)},vt.legend||{});var Zr=function(){function t(t){var e=this;yt(this,"handleEvent",(function(t){var i=e;var n=i.chart,r=ot(t,n),a=function(t,e){var n=null;return u(i.legends,(function(i){u(i,(function(i){var r=i.itemsGroup,a=i.legendHitBoxes,s=r.get("children");if(s.length){var o=i.x,h=i.y;u(a,(function(r,a){if(t>=r.x+o&&t<=r.x+r.width+o&&e>=r.y+h&&e<=r.height+r.y+h)return n={clickedItem:s[a],clickedLegend:i},!1}))}}))})),n}(r.x,r.y);if(a&&!1!==a.clickedLegend.clickable){var s=a.clickedItem,o=a.clickedLegend;if(o.onClick)t.clickedItem=s,o.onClick(t);else if(!o.custom){var h=s.get("checked"),l=s.get("dataValue"),c=o.filteredVals,f=o.field;"single"===o.selectedMode?n.filter(f,(function(t){return t===l})):(h?c.push(l):G(c,l),n.filter(f,(function(t){return-1===c.indexOf(t)}))),n.repaint()}}})),this.legendCfg={},this.enable=!0,this.position="top",T(this,t);var i=this.chart;this.canvasDom=i.get("canvas").get("el"),this.clear()}var e=t.prototype;return e.addLegend=function(t,e,i){var n=this.legendCfg,r=t.field,a=n[r];if(!1===a)return null;if(a&&a.custom)this.addCustomLegend(r);else{var s=n.position||this.position;a&&a.position&&(s=a.position),t.isCategory&&this._addCategoryLegend(t,e,s,i)}},e.addCustomLegend=function(t){var e=this.legendCfg;t&&e[t]&&(e=e[t]);var i=e.position||this.position,n=this.legends;n[i]=n[i]||[];var r=e.items;if(!r)return null;var a=this.container;u(r,(function(t){f(t.marker)?t.marker.radius=t.marker.radius||3:t.marker={symbol:t.marker||"circle",fill:t.fill,radius:3},t.checked=!!s(t.checked)||t.checked,t.name=t.name||t.value}));var o=new Pr(A({},vt.legend[i],e,{maxLength:this._getMaxLength(i),items:r,parent:a}));n[i].push(o)},e.clear=function(){u(this.legends,(function(t){u(t,(function(t){t.clear()}))})),this.legends={},this.unBindEvents()},e._isFiltered=function(t,e,i){var n=!1;return u(e,(function(e){if(n=n||t.getText(e)===t.getText(i))return!1})),n},e._getMaxLength=function(t){var e=this.chart,i=ut(e.get("appendPadding"));return"right"===t||"left"===t?e.get("height")-(i[0]+i[2]):e.get("width")-(i[1]+i[3])},e._addCategoryLegend=function(t,e,i,n){var r=this,a=r.legendCfg,s=r.legends,o=r.container,h=r.chart,l=t.field;s[i]=s[i]||[];var c="circle";a[l]&&a[l].marker?c=a[l].marker:a.marker&&(c=a.marker),u(e,(function(e){f(c)?T(e.marker,c):e.marker.symbol=c,n&&(e.checked=!r._isFiltered(t,n,e.dataValue))})),h.get("legendItems")[l]=e;var g=A({},vt.legend[i],a[l]||a,{maxLength:r._getMaxLength(i),items:e,field:l,filteredVals:n,parent:o});g.showTitle&&A(g,{title:t.alias||t.field});var p=new Pr(g);return s[i].push(p),p},e._alignLegend=function(t,e,i){var n=this.plotRange,r=n.tl,a=n.bl,s=this.chart,o=t.offsetX||0,h=t.offsetY||0,u=s.get("width"),l=s.get("height"),c=ut(s.get("appendPadding")),f=t.getHeight(),g=t.getWidth(),p=0,d=0;if("left"===i||"right"===i){var v=t.verticalAlign||"middle",y=Math.abs(r.y-a.y);p="left"===i?c[3]:u-g-c[1],d=(y-f)/2+r.y,"top"===v?d=r.y:"bottom"===v&&(d=a.y-f),e&&(d=e.get("y")-f-12)}else{var m=t.align||"left";if(p=c[3],"center"===m?p=u/2-g/2:"right"===m&&(p=u-(g+c[1])),d="top"===i?c[0]+Math.abs(t.container.getBBox().minY):l-f,e){var x=e.getWidth();p=e.x+x+12}}"bottom"===i&&h>0&&(h=0),"right"===i&&o>0&&(o=0),t.moveTo(p+o,d+h)},e.alignLegends=function(){var t=this;return u(t.legends,(function(e,i){u(e,(function(n,r){var a=e[r-1];t._alignLegend(n,a,i)}))})),t},e.bindEvents=function(){var t=this.legendCfg.triggerOn||"touchstart";nt(this.canvasDom,t,this.handleEvent)},e.unBindEvents=function(){var t=this.legendCfg.triggerOn||"touchstart";rt(this.canvasDom,t,this.handleEvent)},t}();function Ur(t){var e=new Zr({container:t.get("backPlot").addGroup(),plotRange:t.get("plotRange"),chart:t});t.set("legendController",e),t.legend=function(t,i){var n=e.legendCfg;return e.enable=!0,b(t)?(e.enable=t,n=i||{}):h(t)?n=t:n[t]=i,e.legendCfg=n,this}}function Jr(t){var e=t.get("legendController");if(!e.enable)return null;var i=e.legendCfg,n=e.container;if(i&&i.custom)e.addCustomLegend();else{var r=t.getLegendItems(),a=t.get("scales"),s=t.get("filters");u(r,(function(t,i){var n,r=a[i],o=r.values;n=s&&s[i]?o.filter((function(t){return!s[i](t)})):[],e.addLegend(r,t,n)}))}i&&!1!==i.clickable&&e.bindEvents();var o=e.legends,h={top:0,right:0,bottom:0,left:0};u(o,(function(e,i){var n=0;u(e,(function(t){var e=t.getWidth(),r=t.getHeight();"top"===i||"bottom"===i?(n=Math.max(n,r),t.offsetY>0&&(n+=t.offsetY)):(n=Math.max(n,e),t.offsetX>0&&(n+=t.offsetX))})),h[i]=n+function(t,e){var i=0;switch(e=ut(e),t){case"top":i=e[0];break;case"right":i=e[1];break;case"bottom":i=e[2];break;case"left":i=e[3]}return i}(i,t.get("appendPadding"))})),t.set("legendRange",h),Object.keys(o).length?n.set("ariaLabel",dt.legend.prefix):n.set("ariaLabel",null)}function $r(t){t.get("legendController").alignLegends()}function Kr(t){t.get("legendController").clear(),t.set("legendRange",null)}var Qr={init:Ur,beforeGeomDraw:Jr,afterGeomDraw:$r,clearInner:Kr},ta=Object.freeze({__proto__:null,init:Ur,beforeGeomDraw:Jr,afterGeomDraw:$r,clearInner:Kr,default:Qr}),ea="object"==typeof performance&&performance.now?performance:Date,ia=function(){function t(){this.anims=[],this.time=null,this.playing=!1,this.canvas=[]}var e=t.prototype;return e.play=function(){var t=this;t.time=ea.now(),t.playing=!0,Pn((function e(){t.playing&&(Pn(e),t.update())}))},e.stop=function(){this.playing=!1,this.time=null,this.canvas=[]},e.pushAnim=function(t){this.playing||this.play();var e=t.delay,i=t.duration,n=this.time+e,r=n+i;t.startTime=n,t.endTime=r,this.anims.push(t)},e.update=function(){var t=ea.now();if(this.canvas=[],this.anims.length){for(var e=0;e=i.startTime&&!i.hasStarted&&(i.hasStarted=!0,i.onStart&&i.onStart());var h=(t-i.startTime)/o;if(h=Math.max(0,Math.min(h,1)),h=i.easing(h),i.onFrame)i.onFrame(h);else for(var u in s){var l=(0,s[u])(h),c=void 0;if("points"===u){c=[];for(var f=Math.max(r.points.length,a.points.length),g=0;g=i.endTime&&!i.hasEnded&&(i.hasEnded=!0,i.onEnd&&i.onEnd()),1===h&&(this.anims.splice(e,1),e--)}}}this.canvas.map((function(t){return t.draw(),t})),this.time=ea.now()}else this.stop()},t}();function na(t){return t}function ra(t){return 1-aa(1-t)}function aa(t){return(t/=1)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}var sa=Object.freeze({__proto__:null,linear:na,quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=n/(2*Math.PI)*Math.asin(1/i),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:ra,bounceOut:aa,bounceInOut:function(t){return t<.5?.5*ra(2*t):.5*aa(2*t-1)+.5}});function oa(t){for(var e=[],i=0,n=t.length;ih.x?n.x:h.x,s=h.y+c/2):"xy"===r&&(i.isPolar?(a=i.center.x,s=i.center.y):(a=(h.x+u.x)/2,s=(h.y+u.y)/2));var g=ga(f,[a,s],r);f.isClip=!0,f.endState={matrix:g},f.set("canvas",t.get("canvas")),t.attr("clip",f);pa(f,f.endState,e,(function(){t.attr("clip",null),f.remove(!0)}))}function ma(t,e,i){for(var n=t.get("children"),r=0,a=n.length;r-1&&(t="guide-tag"),h(i)?i[t]:!1!==i&&null}function Ya(){(ba=new ia).play()}function Oa(t){if(!1!==t.get("animate")){var e=t.get("isUpdate"),i=t.get("canvas"),n=t.get("coord"),r=t.get("geoms"),o=i.get("caches")||[];0===o.length&&(e=!1);var h=ka(r,t,n),l=t.get("axisController"),c=l.frontPlot,f=l.backPlot,g=c.get("children").concat(f.get("children")),p=[];t.get("guideController")&&(p=t.get("guideController").guideShapes);var d,v,y=[];if(g.concat(p).forEach((function(e){var i=Ia(e.get("className"),t);e.set("coord",n),e.set("animateCfg",i),y.push(e),h.push(e)})),i.set("caches",function(t){for(var e={},i=0,n=t.length;i1?[1-a,1]:[o,h],this.updateRange(e)}},e.updateRange=function(t){var e=this.values,i=t[0],n=t[1];i=Math.max(0,i),n=Math.min(1,n),this.range=[i,n];var r=e.length,a=i*r,s=n*r,o=e.slice(a,s);this.repaint(o)},e.repaint=function(t){var e=this.chart,i=this.getPinchScale(),n=i.values,r=i.ticks;(function(t,e){if(t.length!==e.length)return!1;var i=t.length-1;return t[0]===e[0]&&t[i]===e[i]})(n,t)||(this.updateScale(i,{ticks:r,values:t}),this.updateFollowScale(i,t),e.repaint())},e.updateFollowScale=function(t,e){var i=this.chart,n=this.getFollowScale(),r=t.field,a=t.type,s=n.field,o=[],h={};e.forEach((function(t){h[t]=!0})),i.get("data").forEach((function(t){if("timeCat"===a){var e=ct(t[r]);h[e]&&o.push(t[s])}}));var u=R(o),l=u.min,c=u.max;this.updateScale(n,{min:l,max:c,nice:!0})},e.updateScale=function(t,e){t&&t.change(e)},e.updateTicks=function(){var t=this.chart,e=this.values,i=this.getPinchScale(),n=i.values,r=i.tickCount,a=Math.round(r*e.length/n.length),s=Kt("cat")({tickCount:a,values:e});this.updateScale(i,{ticks:s,values:n}),t.repaint()},e.destroy=function(){var t=this.chart;t.off("afterinit",this._afterinit),t.off("afterdatachange",this._afterdatachange)},t}(),Xa=function(){var t=e.prototype;function e(t,e){var i=this;yt(this,"type",""),yt(this,"startEvent","touchstart"),yt(this,"processEvent","touchmove"),yt(this,"endEvent","touchend"),yt(this,"resetEvent",null),yt(this,"context",null),yt(this,"_start",(function(t){i.preStart&&i.preStart(t),i.start(t),i.onStart&&i.onStart(t)})),yt(this,"_process",(function(t){i.preProcess&&i.preProcess(t),i.process(t),i.onProcess&&i.onProcess(t)})),yt(this,"_end",(function(t){i.preEnd&&i.preEnd(t),i.end(t),i.onEnd&&i.onEnd(t)})),yt(this,"_reset",(function(t){i.preReset&&i.preReset(t),i.reset(t),i.onReset&&i.onReset(t)})),T(this,this.getDefaultCfg(),t),this.context=this.getInteractionContext(e),this.chart=e;var n=this.range;n&&(this.context.range=n),this._bindEvents(e)}return t.getDefaultCfg=function(){return{}},t.getInteractionContext=function(t){var e=t.get("interactionContext");return e||(e=new Ba(t),t.set("interactionContext",e),e)},t._bindEvents=function(t){var e=this.startEvent,i=this.processEvent,n=this.endEvent,r=this.resetEvent,a=t.get("canvas");a.on(e,this._start),a.on(i,this._process),a.on(n,this._end),a.on(r,this._reset)},t._clearEvents=function(){var t=this.chart,e=this.startEvent,i=this.processEvent,n=this.endEvent,r=this.resetEvent,a=t.get("canvas");a.off(e,this._start),a.off(i,this._process),a.off(n,this._end),a.off(r,this._start)},t.start=function(){},t.process=function(){},t.end=function(){},t.reset=function(){},t.destroy=function(){this.context.destroy(),this._clearEvents()},e}(),La=function(t){function e(){return t.apply(this,arguments)||this}xt(e,t);var i=e.prototype;return i.getDefaultCfg=function(){return{type:"pan",startEvent:"panstart",processEvent:"pan",endEvent:"panend"}},i.start=function(){this.context.start()},i.process=function(t){var e=t.direction,i=t.deltaX;if("up"!==e&&"down"!==e){t.preventDefault&&t.preventDefault();var n=this.context,r=n.chart.get("coord"),a=r.start,s=i/(r.end.x-a.x);n.doMove(s)}},e}(Xa),ja=function(t){xt(i,t);var e=i.prototype;function i(e,i){var n;return T(_t(n=t.call(this,e,i)||this).context,e),n}return e.getDefaultCfg=function(){return{type:"pinch",startEvent:"pinchstart",processEvent:"pinch",endEvent:"pinchend"}},e.start=function(){this.context.start()},e.process=function(t){t.preventDefault&&t.preventDefault();var e=t.zoom,i=t.center,n=this.context,r=n.chart.get("coord"),a=r.start,s=r.end,o=s.x-a.x,h=Math.abs(i.x-a.x)/o,u=Math.abs(s.x-i.x)/o;n.doZoom(h,u,e)},e.end=function(){this.context.updateTicks()},i}(Xa);Fn.registerInteraction("pan",La),Fn.registerInteraction("pinch",ja);var Ga={Marker:Ji.Marker,Tooltip:Tr};Fn.plugins.register([Xr,ta,Vr,Fa]);var Ra={Component:Ga,Global:vt,Chart:Fn,Shape:jt,G:In,Util:ft,Helper:En,track:zn,Animate:fa};t.Animate=fa,t.Chart=Fn,t.Component=Ga,t.G=In,t.Global=vt,t.Helper=En,t.Shape=jt,t.Util=ft,t.default=Ra,t.track=zn,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/uni_modules/lime-f2/components/lime-f2/index.vue b/uni_modules/lime-f2/components/lime-f2/index.vue new file mode 100644 index 0000000..94bcf5a --- /dev/null +++ b/uni_modules/lime-f2/components/lime-f2/index.vue @@ -0,0 +1,437 @@ + + + diff --git a/uni_modules/lime-f2/components/lime-f2/utils.js b/uni_modules/lime-f2/components/lime-f2/utils.js new file mode 100644 index 0000000..a93be4c --- /dev/null +++ b/uni_modules/lime-f2/components/lime-f2/utils.js @@ -0,0 +1,65 @@ +// #ifndef APP-NVUE +// 计算版本 +export function compareVersion(v1, v2) { + v1 = v1.split('.') + v2 = v2.split('.') + const len = Math.max(v1.length, v2.length) + while (v1.length < len) { + v1.push('0') + } + while (v2.length < len) { + v2.push('0') + } + for (let i = 0; i < len; i++) { + const num1 = parseInt(v1[i], 10) + const num2 = parseInt(v2[i], 10) + + if (num1 > num2) { + return 1 + } else if (num1 < num2) { + return -1 + } + } + return 0 +} + +export function wrapEvent(e) { + if (!e) return; + if (!e.preventDefault) { + e.preventDefault = function() {}; + } + return e; +} + +export const pixelRatio = uni.getSystemInfoSync().pixelRatio +// #endif +// #ifdef APP-NVUE +export function base64ToPath(base64) { + return new Promise((resolve, reject) => { + const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []; + const bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now()) + bitmap.loadBase64Data(base64, () => { + if (!format) { + reject(new Error('ERROR_BASE64SRC_PARSE')) + } + const time = new Date().getTime(); + const filePath = `_doc/uniapp_temp/${time}.${format}` + + bitmap.save(filePath, {}, + () => { + bitmap.clear() + resolve(filePath) + }, + (error) => { + bitmap.clear() + console.error(`${JSON.stringify(error)}`) + reject(error) + }) + }, (error) => { + bitmap.clear() + console.error(`${JSON.stringify(error)}`) + reject(error) + }) + }) +} +// #endif \ No newline at end of file diff --git a/uni_modules/lime-f2/package.json b/uni_modules/lime-f2/package.json new file mode 100644 index 0000000..9338677 --- /dev/null +++ b/uni_modules/lime-f2/package.json @@ -0,0 +1,82 @@ +{ + "id": "lime-f2", + "displayName": "蚂蚁图表 antv F2", + "version": "0.5.1", + "description": "全端兼容,一个专注于移动,开箱即用的可视化解决方案", + "keywords": [ + "蚂蚁金服", + "AntV", + "F2", + "canvas", + "图表" +], + "repository": "https://gitee.com/liangei/lime-f2", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + }, + "dependencies": { + } +} diff --git a/uni_modules/lime-f2/readme.md b/uni_modules/lime-f2/readme.md new file mode 100644 index 0000000..744b79a --- /dev/null +++ b/uni_modules/lime-f2/readme.md @@ -0,0 +1,358 @@ +# F2 图表 +> F2,一个专注于移动,开箱即用的可视化解决方案 [查看更多](http://liangei.gitee.io/limeui/#/f2) +> 基于antv F2 做了兼容处理,更多示例请访问 [uni示例](http://liangei.gitee.io/limeui/#/f2-example) [官方示例](https://f2.antv.vision/zh/examples/gallery) +> Q群:1046793420 +> antv F2 v3.8.7 + + + +## 平台兼容 + +| H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 头条小程序 | QQ 小程序 | App | +| --- | ---------- | ------------ | ---------- | ---------- | --------- | ---- | +| √ | √ | √ | √ | √ | √ | √ | + + +* ✨ **注意** +* 🔔 插件用到了 css 预编译器 [stylus](https://ext.dcloud.net.cn/plugin?name=compile-stylus) 请安装 +* 🌈 本插件使用了`webview`支持`nvue`。 +* 📦 本插件没有对F2内部的方法和样式做过改动,只是使其兼容uniapp。 +* 🔔 若F2无法满足于你或有需要特殊能力的请直接去F2 提建议 +* 👉 若F2有兼容问题可向我反馈。 +* 🔔 默认只提供`f2.min.js`,如果需要`f2-all`或`f2-simple`可去码云下载按自已需要引入! + +## 安装 +在uniapp 插件市场 找到 [蚂蚁图表](https://ext.dcloud.net.cn/plugin?id=4613) 导入即可 + +## 代码演示 + +### 基础用法 +通过`ref`获取节点组件内部`init`方法生成图表 + +```html + +``` + +```js +// 非 nvue 页面需要引进 +import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'; +import lF2 from '@/uni_modules/lime-f2/components/lime-f2/' +export default { + components: {lF2}, + data() { + return { + baseData: [{ genre: '成犬粮', sold: 275 }, { genre: '化毛膏', sold: 115 }, { genre: '益生菌', sold: 120 }, { genre: '氨糖', sold: 350 }, { genre: '其它', sold: 150 }], + }; + }, + mounted() { + this.$refs.chart.init(config => { + const chart = new F2.Chart(config); + chart.source(this.baseData); + chart + .interval() + .position('genre*sold') + .color('genre'); + chart.render(); + // 需要把 chart 返回 + return chart; + }); + } +} +``` + +### 图饼 +图饼示例,更多用法和示例请访问[F2 示例](http://liangei.gitee.io/limeui/#/f2-example) + +```html + +``` + +```js +data() { + return { + pieMap: { + '芳华': '40%', + '妖猫传': '20%', + '机器之血': '18%', + '心理罪': '15%', + '寻梦环游记': '5%', + '其他': '2%' + }, + pieData: [ + { + name: '芳华', + percent: 0.4, + a: '1' + }, + { + name: '妖猫传', + percent: 0.2, + a: '1' + }, + { + name: '机器之血', + percent: 0.18, + a: '1' + }, + { + name: '心理罪', + percent: 0.15, + a: '1' + }, + { + name: '寻梦环游记', + percent: 0.05, + a: '1' + }, + { + name: '其他', + percent: 0.02, + a: '1' + } + ] + }; +}, +mounted() { + this.$refs.chart.init(config => { + const chart = new F2.Chart(config); + chart.source(this.pieData, { + percent: { + formatter: val => val * 100 + '%'; + } + }); + chart.legend({ + position: 'right', + itemFormatter: val => val + ' ' + this.pieMap[val]; + }); + chart.tooltip(false); + chart.coord('polar', { + transposed: true, + radius: 0.85 + }); + chart.axis(false); + chart + .interval() + .position('a*percent') + .color('name', ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0']) + .adjust('stack') + .style({ + lineWidth: 1, + stroke: '#fff', + lineJoin: 'round', + lineCap: 'round' + }) + .animate({ + appear: { + duration: 1200, + easing: 'bounceOut' + } + }); + chart.render(); + // 需要把 chart 返回 + return chart; + }); +} +``` + +### 数据更新 +> F2 更新数据的方式有三种: + + +1、通过 `ref` 获取组件实例,使用内部方法`changeData(data)`更新数据 +- 前后数据结构不发生变化,需要马上更新图表。 +```js +this.$refs.chart.changeData(data) +``` + +2、在节点上设置 `source` 源数据和 `isAutoPlay` 自动更新。 +- 前后数据结构不发生变化,需要马上更新图表。 +```html + +``` + +```js +data() { + return { + data: [{ genre: '成犬粮', sold: 275 }, { genre: '化毛膏', sold: 115 }, { genre: '益生菌', sold: 120 }, { genre: '氨糖', sold: 350 }, { genre: '其它', sold: 150 }], + } +} +``` + +3、如果仅仅是更新数据,而不需要马上更新图表,在节点上设置 `source` 源数据,然后在需要更新图表时调用内部方法 `repaint()` 或在节点上设置 `isAutoPlay` 为 `true` +- 前后数据结构不发生变化,不需要立即更新数据 +```html + +``` + +```js +// 1 调用内部方法 +this.$refs.chart.repaint(); +// 2 先设置isAutoPlay为false,再需要时设置为true +this.isAutoPlay = true +``` + +4、更新数据时还可以清除图表上的所有元素,重新定义图形语法,改变图表类型和各种配置。 +- 前后数据结构发生变化 或 需要更改text等元素。 + +```js +this.$refs.chart.reset(chart => { + const baseData = [{ genre: '成犬粮', sold: 375 }, { genre: '化毛膏', sold: 15 }, { genre: '益生菌', sold: 20 }, { genre: '氨糖', sold: 240 }, { genre: '其它', sold: 150 }]; + chart.clear() // 清理所有 + chart.source(baseData); // 加载新数据 + chart.interval().position('genre*sold').color('sold'); // 重新定义图形语法 + chart.render(); + return chart; + }) +}); + +``` + + + +### Nvue +本插件通过`webview`组件使得 `antv F2` 能在`nvue`里使用。 + +* ✨ **温馨提示** +* 👉 webview使用了网络路径,可自行下载放置根目录下的`hybrid`文件夹里再修改路径即可。 +* 🛡 **不需要引进F2 JS文件** +* ⚙️ 在函数外面的数据需要通过`init`方法的第二个参数传递数据 + +```html + +``` +```js +export default { + data() { + return { + baseData: [{ genre: '成犬粮', sold: 275 }, { genre: '化毛膏', sold: 115 }, { genre: '益生菌', sold: 120 }, { genre: '氨糖', sold: 350 }, { genre: '其它', sold: 150 }], + } + }, + mounted() { + this.$refs.chart.init(config => { + const chart = new F2.Chart(config); + // 在函数外面的数据,需要在第二个参数传进去。 + // 数据名保持跟this里的一致 + chart.source(baseData); + chart + .interval() + .position('genre*sold') + .color('genre'); + chart.render(); + return chart; + }, + // 在函数外面的数据需要传进组件 + {baseData: this.baseData} + ); + } +} + +``` +## Nvue 使用注意事项 +- 由于 nvue 使用的是字符串模板传输,打包的时候会被混淆压缩 +- 所在要保持 **关键词** 不被 **混淆压缩** + +#### 1、F2、DataSet 不需要被引入 + +👎 错误 + +```js +import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2-all.min.js'; +import DataSet from '@/antv/DataSet' +export default { + ...code +} +``` + +👍 正确 + +```js +export default { + ...code +} +``` + +#### 2、引用函数外面数据的**关键词**不需要声明 + +👎 错误 + +```js +const {data} = this +this.$refs.chart.init(config => { + chart.source(data); +}) + +``` + +👍 正确 + +```js +// 所有用函数外里的数据,只要保持跟 this 里的一致 +this.$refs.chart.init(config => { + chart.source(data); +}) + +- or - + +this.$refs.chart.init(config => { + chart.source(this.data); +}) +``` + +#### 3、引用函数外面的数据需要通过**params**或函数的第二个参数传递 + +👎 错误 + +```html + + +- or - + +this.$refs.chart.init(config => {...code}) +``` + +👍 正确 + +```html + + +- or - + +this.$refs.chart.init(config => {...code}, {data: this.data}) +``` + +## 不支持的功能 +- 目前由于小程序不支持 `document`,所以 `Guide.Html` 辅助元素组件目前仍无法使用,其他 F2 的功能全部支持。 +- **Nvue**是通过`webview`实现的,所以它不受影响! +- **H5** uni官方 `canvas` 模拟了 小程序 所以也不支持 。 +- 缩放手势暂时不支持,因为原厂也不支持小程序,将来如果有需要考虑修改源码。 +- 词云原厂也是不支持小程序,本插件修改源码使得支持,但头条小程序需要1.78.0以后。 + + +## Props + +| 参数 | 说明 | 类型 | 默认值 | 版本 | +| --------------- | -------- | ------- | ------------ | ----- | +| custom-style | 自定义样式 | `string` | - | - | +| params | 仅针对nvue的数据传递,同init函数的第二个参数,两选一 | `object` | - | - | +| webviewStyles | 仅针对nvue的webview设置样式 | `object` | - | - | +| source | 图表数据 | `array` | - | 0.3.0 | +| type | canvas 类型 2d 仅针对微信和头条有效 | `string` | `2d` | 0.3.0 | +| isAutoPlay | 设置了上方的 图表数据 再 设置本参数 ,只要数据发生改动就更新图表 | `boolean` | `false` | 0.3.0 | +| is-disable-scroll | 触摸图表时是否禁止页面滚动 | `boolean` | `false` | | + +## 事件 + +| 参数 | 说明 | +| --------------- | --------------- | +| init(callback, data) | **callback**: 回调函数 **data**: `nvue` 如果使用了外部数据,需要传递 | +| changeData(data) | 更新数据 ,传递是数据数组 | +| clear() | 清除所有 | +| destroy() | 销毁实例 | +| repaint() | 用于暂时只更新数据,等需要时再调用重绘 | +| reset(callback, data) | 重新定义图形语法,改变图表类型和各种配置, **callback**: 回调函数 **data**: `nvue` 如果使用了外部数据,需要传递 | +| canvasToTempFilePath(opt) | 用于生成图片 | + +## 打赏 +如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。 + +![输入图片说明](https://cdn.jsdelivr.net/gh/liangei/image@latest/222521_bb543f96_518581.jpeg "微信图片编辑_20201122220352.jpg") \ No newline at end of file