角度 12 顶点烛台折线图工具提示错误

如何解决角度 12 顶点烛台折线图工具提示错误

朋友们,今天你好,我刚刚安装了新的 angular 12 项目并安装了顶点图表模块,当我尝试从演示中集​​成顶点烛台线而不是它在工具提示中显示错误时,我的 ts 文件代码如下

import { Component,OnInit,ViewChild } from '@angular/core';

import {ChartComponent,ApexAxisChartSeries,ApexChart,ApexYAxis,ApexXAxis,ApexTitleSubtitle,ApexTooltip} from "ng-apexcharts";
export type ChartOptions = {
  series?: ApexAxisChartSeries | any;
  chart?: ApexChart | any;
  xaxis?: ApexXAxis | any;
  yaxis?: ApexYAxis | any;
  title?: ApexTitleSubtitle | any;
  tooltip?: ApexTooltip | any;
  stroke: any; //ApexStroke
};


@Component({
  selector: 'app-candlestick-line',templateUrl: './candlestick-line.component.html',styleUrls: ['./candlestick-line.component.css']
})
export class CandlestickLineComponent implements OnInit {
  @ViewChild("chart") chart: ChartComponent;
  public chartOptions: Partial<ChartOptions>;

  constructor() {
    this.chartOptions = {
      series: [
        {
          name: "line",type: "line",data: [
            {
              x: new Date(1538778600000),y: 6604
            },{
              x: new Date(1538782200000),y: 6602
            },{
              x: new Date(1538814600000),y: 6607
            },{
              x: new Date(1538884800000),y: 6620
            }
          ]
        },{
          name: "candle",type: "candlestick",y: [6629.81,6650.5,6623.04,6633.33]
            },{
              x: new Date(1538780400000),y: [6632.01,6643.59,6620,6630.11]
            },y: [6630.71,6648.95,6623.34,6635.65]
            },{
              x: new Date(1538784000000),y: [6635.65,6651,6629.67,6638.24]
            },{
              x: new Date(1538785800000),y: [6638.24,6640,6624.47]
            },{
              x: new Date(1538787600000),y: [6624.53,6636.03,6621.68,6624.31]
            },{
              x: new Date(1538789400000),y: [6624.61,6632.2,6617,6626.02]
            },{
              x: new Date(1538791200000),y: [6627,6627.62,6584.22,6603.02]
            },{
              x: new Date(1538793000000),y: [6605,6608.03,6598.95,6604.01]
            },{
              x: new Date(1538794800000),y: [6604.5,6614.4,6602.26,6608.02]
            },{
              x: new Date(1538796600000),y: [6608.02,6610.68,6601.99,6608.91]
            },{
              x: new Date(1538798400000),y: [6608.91,6618.99,6608.01,6612]
            },{
              x: new Date(1538800200000),y: [6612,6615.13,6605.09,{
              x: new Date(1538802000000),6624.12,6608.43,6622.95]
            },{
              x: new Date(1538803800000),y: [6623.91,6623.91,6615,6615.67]
            },{
              x: new Date(1538805600000),y: [6618.69,6618.74,6610,6610.4]
            },{
              x: new Date(1538807400000),y: [6611,6622.78,6610.4,6614.9]
            },{
              x: new Date(1538809200000),y: [6614.9,6626.2,6613.33,6623.45]
            },{
              x: new Date(1538811000000),y: [6623.48,6627,6618.38,6620.35]
            },{
              x: new Date(1538812800000),y: [6619.43,6620.35,6610.05,6615.53]
            },y: [6615.53,6617.93,6615.19]
            },{
              x: new Date(1538816400000),y: [6615.19,6621.6,6608.2,6620]
            },{
              x: new Date(1538818200000),y: [6619.54,6625.17,6614.15,{
              x: new Date(1538820000000),y: [6620.33,6634.15,6617.24,6624.61]
            },{
              x: new Date(1538821800000),y: [6625.95,6626,6611.66,6617.58]
            },{
              x: new Date(1538823600000),y: [6619,6625.97,6595.27,6598.86]
            },{
              x: new Date(1538825400000),y: [6598.86,6598.88,6570,6587.16]
            },{
              x: new Date(1538827200000),y: [6588.86,6600,6580,6593.4]
            },{
              x: new Date(1538829000000),y: [6593.99,6598.89,6585,6587.81]
            },{
              x: new Date(1538830800000),y: [6587.81,6592.73,6567.14,6578]
            },{
              x: new Date(1538832600000),y: [6578.35,6581.72,6567.39,6579]
            },{
              x: new Date(1538834400000),y: [6579.38,6580.92,6566.77,6575.96]
            },{
              x: new Date(1538836200000),y: [6575.96,6589,6571.77,6588.92]
            },{
              x: new Date(1538838000000),y: [6588.92,6594,6577.55,6589.22]
            },{
              x: new Date(1538839800000),y: [6589.3,6589.1,6596.08]
            },{
              x: new Date(1538841600000),y: [6597.5,6588.39,6596.25]
            },{
              x: new Date(1538843400000),y: [6598.03,6588.73,6595.97]
            },{
              x: new Date(1538845200000),y: [6595.97,6602.01,6588.17,6602]
            },{
              x: new Date(1538847000000),y: [6602,6607,6596.51,6599.95]
            },{
              x: new Date(1538848800000),y: [6600.63,6601.21,6590.39,6591.02]
            },{
              x: new Date(1538850600000),y: [6591.02,6603.08,6591,6591]
            },{
              x: new Date(1538852400000),y: [6591,6601.32,6592]
            },{
              x: new Date(1538854200000),y: [6593.13,6596.01,6590,6593.34]
            },{
              x: new Date(1538856000000),y: [6593.34,6604.76,6582.63,6593.86]
            },{
              x: new Date(1538857800000),y: [6593.86,6604.28,6586.57,6600.01]
            },{
              x: new Date(1538859600000),y: [6601.81,6603.21,6592.78,{
              x: new Date(1538861400000),y: [6596.25,6604.2,6602.99]
            },{
              x: new Date(1538863200000),y: [6602.99,6606,6584.99,{
              x: new Date(1538865000000),6595,6583.27,6591.96]
            },{
              x: new Date(1538866800000),y: [6591.97,6596.07,6588.39]
            },{
              x: new Date(1538868600000),y: [6587.6,6598.21,6587.6,6594.27]
            },{
              x: new Date(1538870400000),y: [6596.44,6601,6596.55]
            },{
              x: new Date(1538872200000),y: [6598.91,6605,6596.61,6600.02]
            },{
              x: new Date(1538874000000),y: [6600.55,6589.14,6593.01]
            },{
              x: new Date(1538875800000),y: [6593.15,6592,6603.06]
            },{
              x: new Date(1538877600000),y: [6603.07,6604.5,6599.09,6603.89]
            },{
              x: new Date(1538879400000),y: [6604.44,6604.44,6603.5]
            },{
              x: new Date(1538881200000),y: [6603.5,6603.99,6597.5,6603.86]
            },{
              x: new Date(1538883000000),y: [6603.85,6604.07]
            },y: [6604.98,6604.07,6606]
            }
          ]
        }
      ],chart: {
        height: 350,type: "line"
      },title: {
        text: "CandleStick Chart",align: "left"
      },stroke: {
        width: [3,1]
      },tooltip: {
        shared: false,custom: [
          function({ seriesIndex: any,dataPointIndex: any,w: any }) {
            return w.globals.series[seriesIndex][dataPointIndex];
          },function({ seriesIndex: any,w: any }) {
            const o = w.globals.seriesCandleO[seriesIndex][dataPointIndex];
            const h = w.globals.seriesCandleH[seriesIndex][dataPointIndex];
            const l = w.globals.seriesCandleL[seriesIndex][dataPointIndex];
            const c = w.globals.seriesCandleC[seriesIndex][dataPointIndex];
            return (
              '<div class="apexcharts-tooltip-candlestick">' +
              '<div>Open: <span class="value">' +
              o +
              "</span></div>" +
              '<div>High: <span class="value">' +
              h +
              "</span></div>" +
              '<div>Low: <span class="value">' +
              l +
              "</span></div>" +
              '<div>Close: <span class="value">' +
              c +
              "</span></div>" +
              "</div>"
            );
          }
        ]
      },xaxis: {
        type: "datetime"
      }
    };
  }

  public generateDayWiseTimeSeries(baseval: any,count: any,yrange: any) {
    var i = 0;
    var series = [];
    while (i < count) {
      var y =
        Math.floor(Math.random() * (yrange.max - yrange.min + 1)) + yrange.min;

      series.push([baseval,y]);
      baseval += 86400000;
      i++;
    }
    return series;
  }

  ngOnInit(): void {
  }

}

但是在 serve 命令之后,如果我从工具提示功能中删除 any ,它总是显示错误

 function({ seriesIndex,dataPointIndex,w}) {

比下面的错误显示

enter image description here

但如果我添加任何

function({ seriesIndex: any,w: any }) {

比这个错误显示

enter image description here

请告诉我我该怎么做才能使它正常工作我已经从以下示例中复制了此图

https://apexcharts.com/angular-chart-demos/candlestick-charts/candlestick-with-line/

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-