浏览代码

加下boost 试一试

Karsa 2 年之前
父节点
当前提交
c748db134c
共有 3 个文件被更改,包括 11 次插入3 次删除
  1. 3 0
      index.html
  2. 4 3
      src/components/chart.vue
  3. 4 0
      src/utils/chartOptions.ts

+ 3 - 0
index.html

@@ -8,6 +8,9 @@
   </head>
   <body>
     <div id="app"></div>
+    <script src="https://cdn.highcharts.com.cn/stock/10.1.0/highstock.js"></script>
+    <script src="https://cdn.highcharts.com.cn/10.1.0/modules/boost.js"></script>
+    <script src="https://code.highcharts.com.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
     <script type="module" src="/src/main.ts"></script>
   </body>
 </html>

+ 4 - 3
src/components/chart.vue

@@ -5,11 +5,11 @@
 
 <script lang="ts">
 import { defineComponent, ref, watch, onMounted, PropType } from 'vue';
-import Highcharts from 'highcharts/highstock';
-import HighchartszhCN from '@/utils/highcahrts-zh_CN';
+// import Highcharts from 'highcharts/highstock';
+// import HighchartszhCN from '@/utils/highcahrts-zh_CN';
 import { defaultOpts } from '@/utils/chartOptions';
 
-HighchartszhCN(Highcharts);
+// HighchartszhCN(Highcharts);
 
 export default defineComponent({
   name: '',
@@ -29,6 +29,7 @@ export default defineComponent({
     /* 设置options */
     const init = (): void => {
       const new_options: any = { ...defaultOpts, ...props.options };
+      console.log(new_options);
 
       //stock不支持线形图只支持时间图 画散点图用原始chart
 			let is_scatter = props.options.series ? props.options.series.every((_: any) => _.type === 'scatter') : false ;

+ 4 - 0
src/utils/chartOptions.ts

@@ -32,10 +32,14 @@ export const defaultOpts = {
   ],
   //版权信息
   credits: { enabled: false },
+  boost: {
+    useGPUTranslations: true
+  },
   //数据列通用配置
   plotOptions: {
     series: {
       turboThreshold: 0, //不限制数据点个数
+      boostThreshold: 1,
       dataGrouping: {
         enabled: false,
       },//取消数据大自动数据合并