Plotly.js Angular 4如何为直方图导入plotlyjs笛卡尔束?
我正在使用Angular 4开发一个Web应用程序。基于此,我成功导入了Plotly.js plotly.js基本捆绑包可以与折线图配合使用。但是 我无法在typescript中使用直方图和2d密度图。我怀疑我需要导入plotlyjs笛卡尔束 输出示例 这是我的component.ts,基于但在Typescript中Plotly.js Angular 4如何为直方图导入plotlyjs笛卡尔束?,angular,typescript,histogram,plotly,Angular,Typescript,Histogram,Plotly,我正在使用Angular 4开发一个Web应用程序。基于此,我成功导入了Plotly.js plotly.js基本捆绑包可以与折线图配合使用。但是 我无法在typescript中使用直方图和2d密度图。我怀疑我需要导入plotlyjs笛卡尔束 输出示例 这是我的component.ts,基于但在Typescript中 import * as Plotly from 'plotly.js'; import { Config, Data, Layout } from 'plo
import * as Plotly from 'plotly.js';
import {
Config,
Data,
Layout
} from 'plotly.js';
@Component({
...
})
export class ChartComponent implements OnInit {
constructor() {}
ngOnInit() {
let x = [];
for (let i = 0; i < 500; i++) {
x[i] = Math.random();
}
const trace = {
x: x,
type: 'histogram',
};
const data = [trace];
Plotly.newPlot('myPlotlyDiv', data);
}
}
我已经尝试在plotly-basic.js之后添加../node_modules/plotly.js/dist/plotly-cartesian.js,但这也不起作用
在这种情况下,有没有关于为直方图、Histogram2d图表导入plotlyjs笛卡尔束的建议?我解决了这个问题。我没有使用plotly-basic.min.js包,而是在angle-cli.json和tsconfig.app.json中使用plotly.min.js。带有直方图子图的2D直方图等高线图以4/5的角度显示,打字脚本代码
"types": [
"plotly.js"
],
"paths": {
"plotly.js": [
"../node_modules/plotly.js/dist/plotly-basic.js"
]
}