我使用带有typescript + react的react-chartjs-2,并试图创建一个简单的条形图,但我的浏览器控制台抱怨width未定义。我不太确定下面是否有什么我没有配置的东西? 浏览器控制台错误: Uncaught TypeError: Cannot read property 'width' of undefined
at n.draw (Chart.js:15474)
at Object.draw (Chart.js:7231)
at $t.draw (Chart.js:9825)
at $t.render (Chart.js
我尝试使用chartjs和react-chartjs-2,但显示以下错误:
编译失败。
./node_modules/react-chartjs-2/dist/index.modern.js
Module not found: Can't resolve 'chart.js/auto' in 'C:\Users\An\chart-react\project-folder\client\node_modules\react-chartjs-2\dist'
我的代码:
import React from "react";
import { B
我有一个带有typescript的react应用程序,想在外部使用Chart.js版本2.9.4。
不幸的是,我在使用node index.js运行bundle.js文件的浏览器中遇到以下错误
bundle.js:116 Uncaught ReferenceError: chart is not defined
at bundle.js:116
at bundle.js:216
at bundle.js:216
例如,我的index.js只是一个为dist文件夹提供服务的express服务器:
index.js
const express = require('
正在使用Next.js开发用户仪表板应用程序。我从节点和MongoDB服务器查询我的客户端。我需要使用chart.js加载我的图表。但是当我运行代码时,我会遇到这样的错误。TypeError: chart_js.Chart.register不是一个函数。下面是代码片段:
import {Chart as ChartJS} from 'chart.js';
import { Bar } from 'react-chartjs-2';
import React, { useEffect, useReducer } from 'react';
imp
我正在维护一个使用chart.js作为依赖项(而不是peerDependency)的react组件库。
我将chart.js从3.9.1升级到4.0.1。
我的库仍然编译得很好,但是现在它在导入lib时在我的react应用程序上抛出了一个错误:
Module not found: Error: Package path . is not exported from package node_modules/chart.js
我正在用rollup构建所有东西--这里是我的配置:
import path from 'path';
import babel from '@ro
我想在组件中使用ChartJS,并注意到它也有一个CDN以及react-chartjs-2。
Uncaught ReferenceError: process is not defined
at react-chartjs-2.js:80
at react-chartjs-2.js:4
at react-chartjs-2.js:5
第80行是:
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if
我想在我的网站上使用Chart.js。正如标题所示,我使用的是React.js。要使用Chart.js,我需要这样的画布和上下文:
let context = document.getElementById('canvas').getContext('2d');
let chart = new Chart(context, ...);
所以我这样设计这个组件:
export function updateChart() {
let context = this.refs.chart.getContext('2d');
let ch
我目前正尝试在我的react应用程序中使用Chart.js,但是当我开始构建我的应用程序时,出现了这个错误 ERROR in ./node_modules/chart.js/dist/chart.esm.js
Module parse failed: D:\MyApp\node_modules\chart.js\dist\chart.esm.js Unexpected token (6613:12)
You may need an appropriate loader to handle this file type.
| if (intermediateIndex1 !==
目前,我正在尝试向我的应用程序添加一个包含任意数据的条形图,但我无法将其渲染。它的导入是正确的,我使用了chart.js网站上的示例代码,但没有成功。我遗漏了什么?
import Chart from 'chart.js';
import React, { Component } from 'react';
class ChartTeamOne extends Component {
setState(){
const t1ChartEl= document.getElementById("teamOneCanvas");
let te
我正在尝试使用Chartjs构建React ChartsJS实时数据流我设法将画布渲染到页面上,但由于某些原因,我仍然不能像实时折线图数据那样移动,我不确定是否需要在ChartsJS页面中嵌入任何内容。我安装了这些包:chart.js,"chartjs-adapter-luxon": "^1.1.0,"chartjs-plugin-streaming": "^2.0.0",我希望有人能帮助我! import React from "react";
import { Line } from "react-cha
当我运行server..this组件加载时,在服务器side...but浏览器控制台上找到的...no错误返回如下错误:
Uncaught:(中间值)chartType不是函数
我的代码如下:
var React = require('react');
var ReactDOM = require('react-dom');
var chart = require('chart.js');
var DoughnutChart = require("react-chartjs").Doughnut;
var Tempvshum =