gpt4 book ai didi

javascript - Plottable.js 折线图不显示

转载 作者:行者123 更新时间:2023-11-27 22:58:46 27 4
gpt4 key购买 nike

图表是黑色的,如附图所示。这是一个 Chrome 扩展。当我单击弹出窗口上的“检查”时,定义了plottable/d3元素,因此似乎plottable可用于html Plottable display black

    function drawChart() {

let xScale = new Plottable.Scales.Linear(),
yScale = new Plottable.Scales.Linear(),
xAxis = new Plottable.Axes.Numeric(xScale, "bottom"),
yAxis = new Plottable.Axes.Numeric(yScale, "left"),
plot: Plottable.Plots.Line<number> = new Plottable.Plots.Line();
plot.x(d => d.x, xScale);
plot.y(d => d.y, yScale);
let data = [
{ "x": 0, "y": 1 },
{ "x": 1, "y": 2 },
{ "x": 2, "y": 4 },
{ "x": 3, "y": 8 }
],
dataset: Plottable.Dataset = new Plottable.Dataset(data);
plot.addDataset(dataset);

let chart: Plottable.Components.Table = new Plottable.Components.Table([
[yAxis, plot],
[null, xAxis]
]);
chart.renderTo("svg#VisitorChart");
}


$(document).ready(function() {
drawChart();
});

最佳答案

Plottable.css 文件似乎丢失。

包含该文件可以解决问题。

关于javascript - Plottable.js 折线图不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37334857/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com