当前位置: 首页 > news >正文

试述网站建设的步骤过程成都seo

试述网站建设的步骤过程,成都seo,不通过第三方平台做微网站,打开这个你会感谢我的网站在数据处理和可视化领域,我们经常需要对一系列数据点进行分析。本文将介绍如何在给定的数据点中找到对应于特定Y值的X值,并设置标线起始点标记在ECharts图表中,效果图如下: 实现步骤 1、数据准备 let seriesData [// 提供日期…

在数据处理和可视化领域,我们经常需要对一系列数据点进行分析。本文将介绍如何在给定的数据点中找到对应于特定Y值的X值,并设置标线起始点标记在ECharts图表中,效果图如下:

实现步骤

1、数据准备

let seriesData =  [// 提供日期字符串,ECharts 将自动解析[1672531200000, 220],[1672617600000, 0],[1672704000000, 901],[1672790400000, 1330],[1672876800000, 1630],[1672963200000, 430],[1673049600000, 250]]

2、计算阈值Y值

假设Y值为最大值的90%:

let maxDataValue = seriesData.reduce((max, item) => Math.max(max, item[1]), 0);
let thresholdValue = maxDataValue * 0.9;

3、查找对应的X值

function findXByY(dataPoints, givenY) {// 遍历数据点数组for (let i = 0; i < dataPoints.length - 1; i++) {// 获取当前点和下一个点的坐标const [x1, y1] = dataPoints[i];const [x2, y2] = dataPoints[i + 1];// 判断给定Y值是否在当前点和下一个点之间if (y1 <= givenY && givenY <= y2) {// 计算并返回对应的X值return x1 + (givenY - y1) * (x2 - x1) / (y2 - y1);}}// 如果给定Y值不在任何两个点之间,返回undefinedreturn undefined;
}const xValue = findXByY(seriesData, thresholdValue);

4、在ECharts图表中标记

option = {// ECharts配置项xAxis: {type: 'time',splitLine: {show: false}},yAxis: {type: 'value'},series: [{data: seriesData,type: 'line',markLine: {symbol: ['none', 'none'],data: [// 根据xValue添加垂直于X轴的虚线[{xAxis: xValue,yAxis: 0}, {xAxis: xValue,yAxis: thresholdValue}],// 其他标记线// ...]}}]
}

完整代码:

<template><div><div id="myEcharts" class="charts"></div></div>
</template><script>
import * as echarts from "echarts";
export default {data() {return {};},mounted() {this.seriesData = [[0, 1733286720001],[30, 1733286721001],[40, 1733286722001],[60, 1733286723001],[100, 1733286724001],[100, 1733286725001],[200, 1733286726001],[200, 1733286727001],[300, 1733286728001],[0, 1733286729001],];this.seriesData = this.seriesData.map((pair) => [pair[1], pair[0]]);let firstYZero = this.seriesData.find((pair) => pair[1] === 0);let maxDataValue = this.seriesData.reduce((max, item) => Math.max(max, item[1]),0);let thresholdValue = maxDataValue * 0.9;const xValue = this.findXByY(this.seriesData, thresholdValue);let option = {xAxis: {type: "time", // 使用时间轴name:'日期',splitLine: {show: false,},axisLabel: {interval: 0, },},yAxis: {type: "value",},series: [{data: this.seriesData,type: "line",//   smooth: true,markLine: {symbol: ["none", "none"], // 线两端无箭头data: [// 垂直于X轴的虚线[{xAxis: xValue, // 使用日期字符串yAxis: 0,lineStyle: {color: "#000",}},{xAxis: xValue,yAxis: thresholdValue,},],[{xAxis: firstYZero[0], // 使用日期字符串yAxis: 0,lineStyle: {color: "#000",}},{xAxis: firstYZero[0],yAxis: thresholdValue,},],// 垂直于Y轴的虚线[{xAxis: xValue, // 使用日期字符串yAxis: thresholdValue,label: {formatter: "响应时间",position: "middle", // 标签位置},lineStyle: {color: "#000",}},{xAxis: firstYZero[0],yAxis: thresholdValue,},],[{type: "max",lineStyle: {color: "red",},},{xAxis: "min",yAxis: "max",},],{yAxis: 250,label: {formatter: "标准线",position: "end",},lineStyle: {color: "#00B79D",},},],},},],};let chartDom = document.getElementById("myEcharts");let myChart = echarts.init(chartDom);myChart.setOption(option);},methods: {findXByY(dataPoints, givenY) {for (let i = 0; i < dataPoints.length - 1; i++) {const [x1, y1] = dataPoints[i];const [x2, y2] = dataPoints[i + 1];// 检查给定的 y 值是否在当前点和下一个点之间if (y1 <= givenY && givenY <= y2) {// 计算并返回对应的 x 值return x1 + ((givenY - y1) * (x2 - x1)) / (y2 - y1);}}// 如果给定的 y 值不在任何两个点之间,则返回 undefined 或抛出错误return undefined;},},
};
</script><style scoped>
.charts {width: 100%;height: 600px;
}
</style>

 

 

 

 

 

 

 

http://www.hkea.cn/news/745113/

相关文章:

  • 用网站做自我介绍pptsem推广竞价托管
  • 建设网站项目的目的是什么意思营销型网站方案
  • 濮阳网站建设价格南昌seo排名收费
  • jsp做网站案例steam交易链接在哪里看
  • 做网站需要招聘内容范本信息流广告
  • 如何建公众号外贸网站建设优化
  • 怎么把网站横幅做很大东莞营销推广公司
  • 网站运营与管理实训报告松松软文平台
  • 奉化云优化seo手机网站排名优化软件
  • h5响应式集团网站推荐电商平台有哪些?
  • 企业所得税税率三个档次关键词优化快排
  • 长宁区网站建设b2b免费发布平台
  • php 个人网站网站安全检测工具
  • 做的网站很卡是什么原因seochan是什么意思
  • 怎么做盗版视频网站吗百度权重1
  • 政府网站 建设 计划品牌推广策划方案案例
  • 临沂网站建设那家好小米市场营销案例分析
  • 德化网站建设企业中层管理人员培训课程
  • 网站怎么通过流量赚钱爱站网能不能挖掘关键词
  • 网站建设课后感营销型网站有哪些平台
  • 哪个网站做生鲜配送厦门seo外包公司
  • 水电行业公司设计logo重庆seo排名扣费
  • 可信赖的南昌网站制作站长工具网站
  • 济南建站公司电话成都关键词自然排名
  • 门户网站开发公司推广网页
  • 如何做网站认证实时军事热点
  • 上海的网站建设公司哪家好企业网站建设
  • 专业b2c电商网站制作网站推广要点
  • 现在的网站用什么程序做百度云官网登录入口
  • vs做网站怎样加数据库新闻小学生摘抄