无法转换未定义或空对象
Cannot convert undefined or null object
多年来一直坐下来尝试解决这个问题:/告诉我它不能转换未定义或空对象。非常感谢任何帮助:( 我正在尝试显示这些主要指数的交易量。我正在使用 vega 文档并使用不同的模板,但似乎没有任何东西可以用于我想要显示的可视化
{"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Trading volume of 5 major stock indexes from 2018-2022",
"subtitle":"Source: Yahoo Finance.",
"subtitleFontStyle":"italic",
"subtitleFontSize":10,
"anchor": "start",
"color": "black"
},
"description": "volume of stocks",
"data": {
"url": "https://raw.githubusercontent.com/andrewsnowdon/andrewsnowdon.github.io/main/graph1megasheet.csv",
"format": {"type": "csv"}
},
"height": 300,
"width": 300,
"mark": {"type": "area", "point": "false"},
"selection": {
"Stockname": {"type": "single", "fields": ["Stockname"], "bind": {"input": "select",
"options": [
"DAX",
"DOWJONES",
"FTSE100",
"NASDAQ",
"S&P500"
],
"name": "Select Index: "}
},
"encoding": {
"x": {
"field": "Date",
"type": "temporal",
"title": null,
"axis":{"grid":false}
},
"y": {
"field": "Volume",
"type": "quantitative",
"title": null,
"axis":{"grid":false}
},
"color": {
"field": "Stockname",
"type": "nominal",
"scale": {"scheme": "inferno"},
"title": null,
"legend": {
"orient": "bottom",
"columns":2,
"fillColor": "#FcFdFd"}
},
"opacity": {"condition": {"selection": "region", "value": 1}, "value": 0.1}
}
}}
无法转换未定义或空对象错误不会出现在您共享的 JSON 架构中。引用此模式的代码可能有问题。您实际上没有获得架构,或者调用中可能有拼写错误。
您的 class 必须具有与您拥有的 JSON 相同的属性。
例如,如果您 class 中的一个 属性 的所有字符都是小写的,而 JSON 的第一个字符是大写的,那么它将为空。
多年来一直坐下来尝试解决这个问题:/告诉我它不能转换未定义或空对象。非常感谢任何帮助:( 我正在尝试显示这些主要指数的交易量。我正在使用 vega 文档并使用不同的模板,但似乎没有任何东西可以用于我想要显示的可视化
{"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Trading volume of 5 major stock indexes from 2018-2022",
"subtitle":"Source: Yahoo Finance.",
"subtitleFontStyle":"italic",
"subtitleFontSize":10,
"anchor": "start",
"color": "black"
},
"description": "volume of stocks",
"data": {
"url": "https://raw.githubusercontent.com/andrewsnowdon/andrewsnowdon.github.io/main/graph1megasheet.csv",
"format": {"type": "csv"}
},
"height": 300,
"width": 300,
"mark": {"type": "area", "point": "false"},
"selection": {
"Stockname": {"type": "single", "fields": ["Stockname"], "bind": {"input": "select",
"options": [
"DAX",
"DOWJONES",
"FTSE100",
"NASDAQ",
"S&P500"
],
"name": "Select Index: "}
},
"encoding": {
"x": {
"field": "Date",
"type": "temporal",
"title": null,
"axis":{"grid":false}
},
"y": {
"field": "Volume",
"type": "quantitative",
"title": null,
"axis":{"grid":false}
},
"color": {
"field": "Stockname",
"type": "nominal",
"scale": {"scheme": "inferno"},
"title": null,
"legend": {
"orient": "bottom",
"columns":2,
"fillColor": "#FcFdFd"}
},
"opacity": {"condition": {"selection": "region", "value": 1}, "value": 0.1}
}
}}
无法转换未定义或空对象错误不会出现在您共享的 JSON 架构中。引用此模式的代码可能有问题。您实际上没有获得架构,或者调用中可能有拼写错误。
您的 class 必须具有与您拥有的 JSON 相同的属性。 例如,如果您 class 中的一个 属性 的所有字符都是小写的,而 JSON 的第一个字符是大写的,那么它将为空。