图表为黑色,如所附照片所示。这是一个chrome扩展。当我单击弹出窗口上的inspect时,定义了plottable/d3元素,因此似乎正在使plottable对html可用

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();
});发布于 2020-02-12 17:45:25
Plottable.css文件似乎丢失。
包含该文件可以解决此问题。
https://stackoverflow.com/questions/37334857
复制相似问题