理想汽车股票行情 (理想汽车股票最新价格)

访客 15 0

最新价格

历史数据

// 使用 amCharts 绘制股票走势图am4core.ready(function() {// 配置图表的主题am4core.useTheme(am4themes_animated);// 创建图表var chart = am4core.create("stock-chart", am4charts.XYChart);// 设置数据源var data = [{"date": "2020-07-01","value": 10}, {"date": "2020-07-02","value": 12}, {"date": "2020-07-03","value": 11}, {"date": "2020-07-04","value": 13}, {"date": "2020-07-05","value": 12}, {"date": "2020-07-06","value": 14}];chart.data = data;// 创建时间轴var dateAxis = chart.xAxes.push(new am4charts.DateAxis());dateAxis.renderer.minGridDistance = 50;dateAxis.title.text = "日期";// 创建价值轴var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());valueAxis.title.text = "价值";// 创建系列var series = chart.series.push(new am4charts.LineSeries());series.dataFields.valueY = "value";series.dataFields.dateX = "date";series.tooltipText = "价值: [value]"// 添加滚动条chart.scrollbarX = new am4charts.XYChartScrollbar();chart.scrollbarX.series.push(series);});// 从 API 中获取最新价格fetch("https://api.example.com/stock-price?symbol=LI").then(response => response.json()).then(data => {document.getElementById("latest-price").innerHTML = data.latestPrice;}).catch(error => {console.error("无法获取最新价格:", error);});// 从 API 中获取历史数据fetch("https://api.example.com/stock-history?symbol=LI&period=1d").then(response => response.json()).then(data => {data.forEach(item => {var li = document.createElement("li");li.innerHTML = `${item.date}: ${item.close}`;document.getElementById("historical-data").appendChild(li);});}).catch(error => {console.error("无法获取历史数据:", error);});

标签: 理想汽车股票最新价格 理想汽车股票行情

抱歉,评论功能暂时关闭!