gpt4 book ai didi

javascript - Echarts : Uncaught Error: Component series. 强制不存在。先加载一下

转载 作者:行者123 更新时间:2023-12-03 00:22:31 24 4
gpt4 key购买 nike

我想使用echarts制作数据可视化强制布局,当我按照步骤设置所有选项时,出现错误,说

Uncaught Error: Component series.force not exists. Load it first

我认为可能是javascript出错了,所以我换了另一个版本的echarts.js,但错误仍然存​​在,有人帮助我吗?

顺便说一句,这是我在 stackoverflow 上的第二篇文章,仍在学习如何使用这个平台,所以如果您认为我可以更好地描述问题,请告诉我,谢谢。

这是我的 javascript CDN

    <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.1.0-release/echarts.js"></script>

这是我的主要代码

<div id="main" style="width: 1280px;height:800px;"></div>
<script>
// init
var myChart = echarts.init(document.getElementById('main'));

// if the website is still loading, show the animation
// myChart.showLoading();

var data = data_format(jdata);

var option = {
title : {
text : 'test', // this field will connect to the book name
},
tooltip : {},
toolbox : {
show : true,
feature : {
saveAsImage : {
title : 'save as image',
show : true,
type : 'png'
}
}
},
legend : {},
series : [
{
type : 'force',
name : 'test',
ribbonType : false,
categories : [
{
name : 'person'
}
],
itemStyle : {
normal : {
label : {
show : true,
textStyle : {
color : 'black'
}
},
nodeStyle : {

}
}
},
minRadius : 15,
maxRadius : 25,
gravity : 1,
scaling : 1,
linkSymbol : 'arrow',
steps : 10,
coolDown : 1,
nodes : data.nodes,
links : data.links
}
]
}

// setup all option
myChart.setOption(option);
</script>

最佳答案

根据docs (点击左侧菜单中的系列节点将其打开并查看所有类型)series没有force类型
有效类型有:例如条形图图表

也许这个example会帮助你。它使用一系列类型图,其中有 force对象。

例如从示例:

series : [
{
type: 'graph',
layout: 'force',
force: {
repulsion: 100
}
...

关于javascript - Echarts : Uncaught Error: Component series. 强制不存在。先加载一下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54249562/

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