echarts 一条折线图上显示不同颜色

news2024/9/22 4:43:29

文档树懒学堂:ECharts visualMap 代码实例及对应注释 - 树懒学堂

封装的echarts 组件代码:

<template>

    <div :style="{ height: '100%' }">

        <div class="foldLine" ref="foldLine" :style="{ width: widths, height: heights }"></div>

    </div>

</template>

<script>

import * as echarts from 'echarts';

export default {

    props: {

        id: {

            type: String,

            default: 'lineEchartNew'

        },

        heights: {

            type: String,

            default: '100%'

        },

        widths: {

            type: String,

            default: '100%'

        },

        tagName: {

            type: String,

            default: '排名'

        },

        indexName: {

            type: String,

            default: ''

        },

        chartObj: {

            type: Array,

            default: () => {

                return [];

            }

        },

        objs: {

            type: Object,

            default: () => {

                return {

                    height: '100%'

                };

            }

        }

    },

    data() {

        return {

            chart: null

        };

    },

    watch: {

        chartObj: {

            handler() {

                this.initEchats();

            },

            deep: true

        }

    },

    mounted() {

        this.$nextTick(() => {

            this.init();

        });

    },

    beforeDestroy() {

        this.chart && this.chart.dispose();

        this.chart = null;

    },

    methods: {

        init() {

            this.chart = echarts.init(this.$refs.foldLine);

            this.initEchats();

        },

        // 整体折线图显示不通颜色

        getLineColor(healthList) {

            let arr = [];

            healthList.forEach((v, i) => {

                let obj = {

                    gt: i,

                    lt: i + 1,

                    color: healthList[i] < 90 ? 'rgba(229,27,88,0.68)' : 'rgba(24,232,169,1)' //大于0小于12为绿色

                };

                arr.push(obj);

            });

            return arr;

        },

        initEchats() {

            let xDataList = []; // x轴

            let healthList = []; // 整体

            let xzHealthList = []; // 修障

            let zyHealthList = []; // 装移

            let zycolorList = []; // 装移

            let xzcolorList = []; // 修障

            let isColor = ''; // 整体

            //isColor == 1 说明低于90分 红色: #F32B2B

            this.chartObj &&

                this.chartObj.forEach((v, index) => {

                    xDataList.push(v.region);

                    // 整体

                    if (v.isColor == 0) {

                        isColor = 'rgba(24,232,169,1)';

                    } else if (v.isColor == 1) {

                        isColor = '#F32B2B'; // 红色

                        // isColor = 'rgba(24,232,169,1)';

                    }

                    // 装移

                    if (v.zyIsColor == 0) {

                        zycolorList[index] = ['#1EE7E7', 'rgba(30, 231, 231, 0.35)'];

                    } else if (v.zyIsColor == 1) {

                        zycolorList[index] = ['rgba(243, 43, 43, 0)', '#F32B2B'];

                    }

                    // 修障

                    if (v.xzIsColor == 0) {

                        xzcolorList[index] = ['#1890FF', 'rgba(24, 144, 255, 0.35)'];

                    } else if (v.xzIsColor == 1) {

                        xzcolorList[index] = ['rgba(243, 43, 43, 0)', '#F32B2B'];

                    }

                    if (!this.tagName || this.tagName == '排名') {

                        healthList.push(v.score);

                        xzHealthList.push(v.xzscore);

                        zyHealthList.push(v.zyscore);

                        this.legendData = [

                            {

                                show: true,

                                top: -3,

                                right: 110,

                                itemWidth: 10,

                                itemHeight: 2,

                                data: [

                                    {

                                        name: '整体',

                                        icon: 'rect'

                                    }

                                ],

                                itemStyle: {

                                    color: '#18E8A9'

                                },

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            },

                            {

                                show: true,

                                top: -3,

                                right: 60,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: '装移', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            },

                            {

                                show: true,

                                top: -3,

                                right: 10,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: '修障', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            }

                        ];

                        if (this.indexName == '交付转化') {

                            this.legendData = [

                                {

                                    show: true,

                                    top: -3,

                                    right: 10,

                                    itemWidth: 10,

                                    itemHeight: 10,

                                    data: [{ name: '交付', icon: 'rect' }],

                                    textStyle: {

                                        fontSize: 12,

                                        lineHeight: 12,

                                        color: '#fff',

                                        rich: {

                                            a: {

                                                verticalAlign: 'middle'

                                            }

                                        },

                                        padding: [0, 0, -2, 0] //[上、右、下、左]

                                    }

                                }

                            ];

                        }

                        if (this.indexName == '修障重复申告率') {

                            this.legendData = [

                                {

                                    show: true,

                                    top: -3,

                                    right: 10,

                                    itemWidth: 10,

                                    itemHeight: 10,

                                    data: [{ name: '修障', icon: 'rect' }],

                                    textStyle: {

                                        fontSize: 12,

                                        lineHeight: 12,

                                        color: '#fff',

                                        rich: {

                                            a: {

                                                verticalAlign: 'middle'

                                            }

                                        },

                                        padding: [0, 0, -2, 0] //[上、右、下、左]

                                    }

                                }

                            ];

                        }

                    } else if (this.tagName == '整体') {

                        healthList.push(v.overall);

                        xzHealthList.push(v.xz);

                        zyHealthList.push(v.zy);

                        this.legendData = [

                            {

                                show: true,

                                top: -3,

                                right: 110,

                                itemWidth: 10,

                                itemHeight: 2,

                                data: [

                                    {

                                        name: '整体',

                                        icon: 'rect'

                                    }

                                ],

                                itemStyle: {

                                    color: '#18E8A9'

                                },

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            },

                            {

                                show: true,

                                top: -3,

                                right: 60,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: '装移', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            },

                            {

                                show: true,

                                top: -3,

                                right: 10,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: '修障', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            }

                        ];

                        if (this.indexName == '交付转化') {

                            this.legendData = [

                                {

                                    show: true,

                                    top: -3,

                                    right: 10,

                                    itemWidth: 10,

                                    itemHeight: 10,

                                    data: [{ name: '交付', icon: 'rect' }],

                                    textStyle: {

                                        fontSize: 12,

                                        lineHeight: 12,

                                        color: '#fff',

                                        rich: {

                                            a: {

                                                verticalAlign: 'middle'

                                            }

                                        },

                                        padding: [0, 0, -2, 0] //[上、右、下、左]

                                    }

                                }

                            ];

                        }

                        if (this.indexName == '修障重复申告率') {

                            this.legendData = [

                                {

                                    show: true,

                                    top: -3,

                                    right: 10,

                                    itemWidth: 10,

                                    itemHeight: 10,

                                    data: [{ name: '修障', icon: 'rect' }],

                                    textStyle: {

                                        fontSize: 12,

                                        lineHeight: 12,

                                        color: '#fff',

                                        rich: {

                                            a: {

                                                verticalAlign: 'middle'

                                            }

                                        },

                                        padding: [0, 0, -2, 0] //[上、右、下、左]

                                    }

                                }

                            ];

                        }

                    } else if (this.tagName == '交付') {

                        healthList = [];

                        xzHealthList = [];

                        zyHealthList.push(v.zy);

                        this.legendData = [

                            {

                                show: true,

                                top: -3,

                                right: 10,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: this.indexName == '交付转化' ? '交付' : '装移', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            }

                        ];

                    } else if (this.tagName == '申告') {

                        healthList = [];

                        zyHealthList = [];

                        xzHealthList.push(v.xz);

                        this.legendData = [

                            {

                                show: true,

                                top: -3,

                                right: 10,

                                itemWidth: 10,

                                itemHeight: 10,

                                data: [{ name: this.indexName == '交付转化' ? '交付' : '修障', icon: 'rect' }],

                                textStyle: {

                                    fontSize: 12,

                                    lineHeight: 12,

                                    color: '#fff',

                                    rich: {

                                        a: {

                                            verticalAlign: 'middle'

                                        }

                                    },

                                    padding: [0, 0, -2, 0] //[上、右、下、左]

                                }

                            }

                        ];

                    }

                });

            let seriesAll = [

                {

                    name: '整体',

                    type: 'line',

                    // barWidth: 24,

                    barGap: '1%',

                    // symbol: 'rect',

                    symbolSize: [0, 0],

                    data: healthList,

                    // label: {

                    //     normal: {

                    //         show: true,

                    //         fontSize: 14,

                    //         color: '#fff',

                    //         formatter: '{c}',

                    //         position: 'top'

                    //     }

                    // },

                    itemStyle: {

                        color: 'rgba(24,232,169,1)',

                        // color: isColor,

                        borderColor: '#18E8A9',

                        borderWidth: 1,

                        borderType: 'solid'

                    }

                },

                {

                    name: '装移',

                    type: 'bar',

                    barWidth: 5,

                    barGap: '1%',

                    data: zyHealthList,

                    itemStyle: {

                        normal: {

                            //这里设置每个柱子颜色不一样

                            color: function (params) {

                                let colorItem = zycolorList[params.dataIndex];

                                if (colorItem !== undefined) {

                                    return new echarts.graphic.LinearGradient(

                                        0,

                                        0,

                                        0,

                                        1,

                                        [

                                            {

                                                offset: 0,

                                                color: colorItem[0]

                                            },

                                            {

                                                offset: 1,

                                                color: colorItem[1]

                                            }

                                        ],

                                        false

                                    );

                                }

                            }

                        }

                    }

                    // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

                    //     {

                    //         offset: 0,

                    //         color: '#1EE7E7 '

                    //     },

                    //     {

                    //         offset: 1,

                    //         color: 'rgba(30, 231, 231, 0.35)'

                    //     }

                    // ])

                },

                {

                    name: '修障',

                    type: 'bar',

                    barWidth: 5,

                    barGap: '1%',

                    data: xzHealthList,

                    itemStyle: {

                        normal: {

                            //这里设置每个柱子颜色不一样

                            color: function (params) {

                                let colorItem = xzcolorList[params.dataIndex];

                                if (colorItem !== undefined) {

                                    return new echarts.graphic.LinearGradient(

                                        0,

                                        0,

                                        0,

                                        1,

                                        [

                                            {

                                                offset: 0,

                                                color: colorItem[0]

                                            },

                                            {

                                                offset: 1,

                                                color: colorItem[1]

                                            }

                                        ],

                                        false

                                    );

                                }

                            }

                        }

                    }

                    // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

                    //     {

                    //         offset: 0,

                    //         color: '#1890FF '

                    //     },

                    //     {

                    //         offset: 1,

                    //         color: 'rgba(24, 144, 255, 0.35)'

                    //     }

                    // ])

                }

            ];

            let seriesJiaoFu = [

                {

                    name: '交付',

                    type: 'bar',

                    barWidth: 5,

                    barGap: '1%',

                    data: zyHealthList,

                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

                        {

                            offset: 0,

                            color: '#1EE7E7 '

                        },

                        {

                            offset: 1,

                            color: 'rgba(30, 231, 231, 0.35)'

                        }

                    ])

                }

            ];

            let axisLabelAll = {

                color: 'rgba(230,247,255,0.85)',

                interval: 0, //0: x轴名字没有间隔隐藏,全部显示

                fontSize: 10,

                // rotate: 40, // 调整数值改变倾斜的幅度(范围-90到90)

                formatter: (text) => {

                    return text.replaceAll('分公司', '');

                }

            };

            let axisLabelMore = {

                color: 'rgba(230,247,255,0.85)',

                // interval: 0, //0: x轴名字没有间隔隐藏,全部显示

                fontSize: 10

            };

            let option = {

                tooltip: {

                    trigger: 'axis',

                    axisPointer: {

                        // 坐标轴指示器,坐标轴触发有效 设置鼠标放上去是线还是阴影

                        type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'

                    }

                    // formatter:function(param){

                    //     if(param.length>2){

                    //          return `

                    //          <p>时间:${param[0].name}</p>

                    //          <p>${param[0].seriesName}:能耗${param[0].data},PRB利用率:${param[1].data}</p>

                    //             <p>${param[2].seriesName}:能耗:${param[2].data},PRB利用率:${param[3].data}</p>

                    //         `

                    //     }else{

                    //          return `

                    //           <p>时间:${param[0].name}</p>

                    //          <p>${param[0].seriesName}:能耗${param[0].data},PRB利用率:${param[1].data}</p>

                    //         `

                    //     }

                    // }

                },

                legend: this.legendData,

                grid: {

                    top: '16%',

                    left: '3%',

                    right: '5%',

                    bottom: '7%',

                    containLabel: true

                },

                yAxis: {

                    name: '',

                    nameTextStyle: {

                        color: '#fff',

                        align: 'center'

                    },

                    nameGap: 20,

                    type: 'value',

                    splitLine: {

                        show: true,

                        lineStyle: {

                            //轴线样式

                            type: 'dashed', // dotted

                            color: 'rgba(230, 247, 255, 0.2)'

                        }

                    },

                    axisLine: {

                        //坐标轴轴线

                        show: false, //是否显示

                        lineStyle: {

                            //轴线样式

                            color: '#656A94'

                        }

                    },

                    axisTick: {

                        show: false //是否显示刻度

                    },

                    axisLabel: {

                        inside: false, //数值内侧外侧

                        // padding: [0, 4, 15, 0],

                        showMinLabel: true,

                        showMaxLabel: true,

                        color: 'rgba(230,247,255,0.6)',

                        fontSize: 12

                        // formatter:function(text,index){

                        //     return text+"%";

                        // }

                    }

                },

                xAxis: [

                    {

                        type: 'category',

                        data: xDataList,

                        axisLine: {

                            lineStyle: {

                                color: '#E6F7FF'

                            }

                        },

                        axisTick: {

                            show: false

                        },

                        // axisLabel: {

                        //     color: 'rgba(230,247,255,0.85)',

                        //     interval: 0, //0: x轴名字没有间隔隐藏,全部显示

                        //     fontSize: 10,

                        //     // rotate: 40, // 调整数值改变倾斜的幅度(范围-90到90)

                        //     formatter: (text) => {

                        //         return text.replaceAll('分公司', '');

                        //     }

                        // }

                        axisLabel: xDataList.length > 12 ? axisLabelMore : axisLabelAll

                    },

                    {

                        type: 'category',

                        axisLine: {

                            show: false

                        },

                        axisTick: {

                            show: false

                        },

                        axisLabel: {

                            show: false

                        }

                    }

                ],

                series: this.indexName == '交付转化' ? seriesJiaoFu : seriesAll,

                // 一条折线图显示不通颜色

                visualMap:

                    this.indexName == '交付转化'

                        ? null

                        : {

                              type: 'piecewise',

                              show: false,

                              dimension: 0,

                              seriesIndex: 0,

                              pieces: this.getLineColor(healthList)

                              //   pieces: [

                              //       {

                              //           gt: 0,

                              //           lt: 1,

                              //           color: healthList[0] < 90 ? 'rgba(229,27,88,0.68)' : 'rgba(24,232,169,1)' //大于0小于12为绿色

                              //       },

                              //       {

                              //           gt: 1,

                              //           lt: 2,

                              //           color: healthList[1] < 90 ? 'rgba(229,27,88,0.68)' : 'rgba(24,232,169,1)' //大于0小于12为绿色

                              //       },

                              //   ]

                          }

            };

            if (option && typeof option === 'object') {

                this.chart.clear(); //画布清空

                this.chart.resize(); //自适应div的大小

                this.chart.setOption(option, true);

                // this.chart.setOption(

                //     {

                //         series: seriesArr

                //     },

                //     { notMerge: false, lazyUpdate: false, silent: false }

                // );

            }

        }

    }

};

</script>

<style lang="scss" scoped></style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1437110.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

ValueError: PEFT backend is required for this method.

根据异常栈发现USE_PEFT_BACKEND是False导致的 if not USE_PEFT_BACKEND:raise ValueError("PEFT backend is required for this method.")找到定义此变量文件&#xff0c;PEFT >0.6 and transformers > 4.34.0 解决方法 升级包 pip install -U PEFT tra…

2.6:冒泡、简选、直插、快排,递归,宏

1.冒泡排序、简单选择排序、直接插入排序、快速排序(升序) 程序代码&#xff1a; 1 #include<stdio.h>2 #include<string.h>3 #include<stdlib.h>4 void Bubble(int arr[],int len);5 void simple_sort(int arr[],int len);6 void insert_sort(int arr[],in…

pwn旅行之[WUSTCTF 2020]getshell2(一些小知识)

题目分析1 首先打开这个题目的链接的时候&#xff0c;看到了ret2syscall&#xff0c;以为是一个纯正的syscall的题&#xff0c;结果&#xff0c;做的时候发现这个题的危险函数限制的字符串个数不足以写入syscall需要的所有地址&#xff0c;所以&#xff0c;这里参考dalao们的方…

成都爱尔林江院长讲解RGP,一种透氧且度数“上限极高”的隐形眼镜

想戴隐形眼镜&#xff0c;脱离框架的束缚。 想戴可又不知道该怎么选。 能夜晚戴镜白天摘镜的角膜塑形镜&#xff0c;近视超过600度又戴不了。 软性隐形眼镜无论透明的还是美瞳&#xff0c;大多透氧率低对眼睛也不太好。 RGP&#xff0c;一种硬性透氧性角膜接触镜&#xff0…

甲骨文吴承杨:2024年才刚开始,生成式AI已在重塑行业 | 探路2024

ITValue 到2026年&#xff0c;将有超过80%的企业使用生成式AI的API或模型&#xff0c;或在生产环境中部署支持生成式AI应用。 作者&#xff5c;杨丽 首发&#xff5c;钛媒体 ITValue “企业需要的是能够改善业务成果的生成式AI功能和用例。除此之外&#xff0c;企业还需要一个可…

探索Web API SpeechSynthesis:给你的网页增添声音

Web API SpeechSynthesis是一项强大的浏览器功能&#xff0c;它允许开发者将文本转换为语音&#xff0c;并通过浏览器播放出来。本文将深入探讨SpeechSynthesis的控制接口&#xff0c;包括其功能、用法和一个完整的JavaScript示例。 参考资料&#xff1a;SpeechSynthesis - Web…

安卓学习笔记之八:本地化的简单例子(kotlin版本)

本地化及多语言支持&#xff0c;是目前手机软件必须面对的问题&#xff0c;这里用一个简单的例子来说明在Android Studio下如何实现。 创建一个Empty Views Activity项目&#xff0c;语言选择Kotlin 实现一个简单的功能&#xff0c;一条欢迎&#xff0c;一个按钮&#xff0c;…

博客|基于Springboot的个人博客系统设计与实现(源码+数据库+文档)

个人博客系统目录 目录 基于Springboot的个人博客系统设计与实现 一、前言 二、系统功能设计 三、系统实现 1、管理员功能实现 &#xff08;1&#xff09;用户管理 &#xff08;2&#xff09;文章分类管理 &#xff08;3&#xff09;公告信息管理 &#xff08;4&#…

【数据分享】1929-2023年全球站点的逐日降水量数据(Shp\Excel\免费获取)

气象数据是在各项研究中都经常使用的数据&#xff0c;气象指标包括气温、风速、降水、湿度等指标&#xff0c;说到常用的降水数据&#xff0c;最详细的降水数据是具体到气象监测站点的降水数据&#xff01; 有关气象指标的监测站点数据&#xff0c;之前我们分享过1929-2023年全…

Vue3大事件项目(ing)

文章目录 核心内容1.大事件项目介绍2.大事件项目创建3.Eslint配置代码风格4.配置代码检查工作流问题: pnpm lint是全量检查,耗时问题,历史问题 5.目录调整6.vue-router4 路由代码解析7.引入 Element Plus 组件库8.Pinia 构建仓库 和 持久化9.Pinia 仓库统一管理 核心内容 Vue3…

2024年信息管理与工业制造与自动化国际学术会议(ICIMIMA2024)

2024年信息管理与工业制造与自动化国际学术会议(ICIMIMA2024) 会议简介 2024年信息管理与工业制造及自动化国际学术会议&#xff08;ICIMIMA2024&#xff09;将在中国三亚举行。会议旨在为信息管理和工业工程领域的专家、学者、工程师和技术人员提供一个平台&#xff0c;分享…

【数据结构】链表OJ面试题3(题库+解析)

1.前言 前五题在这http://t.csdnimg.cn/UeggB 后三题在这http://t.csdnimg.cn/gbohQ 记录每天的刷题&#xff0c;继续坚持&#xff01; 2.OJ题目训练 9. 给定一个链表&#xff0c;判断链表中是否有环。 力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成…

python flask 魔术方法

魔术方法作用_init_对象的初始化方法_class_返回对象所属的类_module_返回类所在的模块_mro_返回类的调用顺序&#xff0c;可以找到其父类&#xff08;用于找父类&#xff09;_base_获取类的直接父类&#xff08;用于找父类&#xff09;_bases_获取父类的元组&#xff0c;按它们…

开启一个服务,将服务器指定的文件读取,传播到网上其他终端

from flask import Flask, render_template_string app Flask(__name__)app.route(/get-data) def get_data():# 读取data.txt文件的内容with open(r./2024/2/4/data.txt, r) as file:data file.read()print(data)# 返回数据的HTML表示return render_template_string(<div…

成功解决:AssertionError: Torch not compiled with CUDA enabled

在运行pycharm项目的时候&#xff0c;出现了以上的报错&#xff0c;主要可以归结于以下两个个方面&#xff1a; 1、没有安装GPU版本的pytorch&#xff0c;只是使用清华的镜像地址下载了CPU版本的pytorch 2、安装的CUDA和安装的pytorch的版本不相互对应 我使用 pip list 来…

【2024.2.5练习】砍竹子(25分)

题目描述 题目分析 考虑题目是否满足贪心。每次施展魔法会使一段连续的竹子高度变为一半左右的平方根。根据样例&#xff0c;似乎每次让最高的竹子变短就能得到最优解。 假设魔法一次只能对一根竹子使用&#xff0c;永远不出现连续相同高度的竹子&#xff0c;那么显然无论使用…

逆向工程:揭开科技神秘面纱的艺术

在当今这个科技飞速发展的时代&#xff0c;我们每天都在与各种电子产品、软件应用打交道。然而&#xff0c;你是否想过&#xff0c;这些看似复杂的高科技产品是如何被创造出来的&#xff1f;今天&#xff0c;我们就来探讨一下逆向工程这一神秘而又令人着迷的领域。 一、什么是…

Unity 接口、抽象类、具体类对象的配合使用案例

文章目录 示例1&#xff1a;接口&#xff08;Interface&#xff09;示例2&#xff1a;抽象类&#xff08;Abstract Class&#xff09;示例3&#xff1a;结合使用接口与抽象类示例4&#xff1a;多接口实现示例5&#xff1a;抽象类与接口结合 在Unity中使用C#编程时&#xff0c;接…

SSL协议是什么?关于SSL和TLS的常见问题解答

SSL&#xff08;安全套接字层&#xff09;及其后继者TLS&#xff08;传输层安全&#xff09;是用于在联网计算机之间建立经过身份验证和加密的链接的协议。尽管SSL协议在 1999年已经随着TLS 1.0的发布而被弃用&#xff0c;但我们仍将这些相关技术称为“SSL”或“SSL/TLS”。那么…

[C/C++] -- JSON for Modern C++

JSON for Modern C&#xff08;nlohmann/json&#xff09;是一个流行的 C JSON 库&#xff0c;由德国开发者nlohmann编写。这个库提供了简洁而灵活的 API&#xff0c;使得在C中解析和生成JSON数据变得非常方便。 1.JSON简介 JSON&#xff08;JavaScript Object Notation&…