Android 自定义坐标曲线图(二)

Android 自定义坐标曲线图_android 自定义曲线图-CSDN博客

     
继上一篇文章,点击折线图上的点,显示提示信息进行修改,之前通过回调,调用外部方法,使用popupwindow或dialog来显示,但是这种方法对于弹框显示的位置很难控制,而且采用popupwindow或dialog是具有唯一性的,也就是显示后,必须先关闭,才能显示下一个点的弹框,这种在某些需求上是不符合的,这种只适合每次只弹一个弹框,且固定在底部,或者居中显示,就可以,实现起来简单。这种方式只适合在页面只有一个折线图的情况下,不适合运用到RecyclerView中,每个item都出现折线图的情况。

如果是要显示在点击到的点的上方,就很难控制,无法精准,并且在分辨率不同的手机会出现较大的差异。因此做了以下修改:

更新如下(20240329):点击点提示信息,不再使用popupwindow或dialog,还是通过自定义,引入xml布局来实现,适合运用到页面只有一个折线图,也适合RecyclerView中出现多个折线图的情况。具体实现代码如下:

public void showDialog(Canvas c, Point point) {c.save();c.translate((point.x - dip2px(45f)), (point.y - dip2px(30f) - CIRCLE_SIZE / 2f));FrameLayout frameLayout = new FrameLayout(mContext);frameLayout.setLayoutParams(new ViewGroup.LayoutParams(200, 200));LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);View v = li.inflate(R.layout.dialog_valuation_tracker, null);v.setLayoutParams(newFrameLayout.LayoutParams(dip2px(90f), dip2px(26f)));frameLayout.addView(v);frameLayout.measure(bWidth, bHeight);frameLayout.layout(100, 100, 100, 100);frameLayout.draw(c);c.restore();}

可以看到,是通过引入xml的形式来实现,使用xml能更加的实现多样化样式,要显示什么样子的提示框,可自行在xml里面修改,比如可以加入图片等;并且可以更好的控制显示的位置。可以通过再添加一些方法给外部调用即可

完整代码如下

public class BrokenLineView extends View {private static final int CIRCLE_SIZE = 40;private static enum LineStyle {LINE, CURVE}private static enum YLineStyle {DASHES_LINE, FULL_LINE, NOT_LINE}private static enum ShaderOrientationStyle {ORIENTATION_H, ORIENTATION_V}private final Context mContext;private OnClickListener listener;private LineStyle mStyle = LineStyle.LINE;private YLineStyle mYLineStyle = YLineStyle.NOT_LINE;private ShaderOrientationStyle mShaderOrientationStyle = ShaderOrientationStyle.ORIENTATION_V;private int canvasWidth;private int bHeight = 0;private int bWidth = 0;private int marginLeft;private int marginRight;private boolean isMeasure = true;private int xTextWidth = 0;//Y textprivate int spacingHeight;private double averageValue;private int marginTop = 0;private int marginBottom = 0;/*** data*/private Point[] mPoints;private List<String> yRawData = new ArrayList<>();private ValuationTrackerPointData pointData;private List<String> xRawData = new ArrayList<>();private final List<Double> dataList = new ArrayList<>();private final List<Integer> xList = new ArrayList<>();// x valueprivate final Map<String, Integer> xMap = new HashMap<>();/*** paint color*/private int xTextPaintColor;private int yTextPaintColor;private int startShaderColor;private int endShaderColor;private int mCanvasColor;private int mXLinePaintColor;/*** paint size*/private int xTextSize = 12;private int yTextSize = 12;private Point mSelPoint;public BrokenLineView(Context context) {this(context, null);}public BrokenLineView(Context context, AttributeSet attrs) {super(context, attrs);this.mContext = context;initView();}private void initView() {xTextPaintColor = getColor(mContext, R.color.cl_858585);yTextPaintColor = getColor(mContext, R.color.cl_858585);startShaderColor = getColor(mContext, R.color.cl_c53355_30);endShaderColor = getColor(mContext, R.color.cl_c53355_5);mCanvasColor = getColor(mContext, R.color.white);mXLinePaintColor = getColor(mContext, R.color.cl_EBEBEB);}public void setData(ValuationTrackerPointData pointData) {this.pointData = pointData;averageValue = pointData.getyAverageValue();xRawData.clear();yRawData.clear();dataList.clear();xRawData = pointData.getxAxis();xRawData.add(0, "");yRawData = pointData.getyAxis();for (int i = 0; i < pointData.getPointInfo().size(); i++) {dataList.add(pointData.getPointInfo().get(i).getPrice());}if (null != dataList) {mPoints = new Point[dataList.size()];}if (null != yRawData) {spacingHeight = yRawData.size();}}@Overrideprotected void onSizeChanged(int w, int h, int oldW, int oldH) {if (isMeasure) {marginLeft = dip2px(20);marginRight = dip2px(10);marginTop = dip2px(5);marginBottom = dip2px(40);int canvasHeight = getHeight();this.canvasWidth = getWidth();if (bHeight == 0) {bHeight = canvasHeight - marginBottom - marginTop;}if (bWidth == 0) {bWidth = canvasWidth - marginLeft - marginRight;}isMeasure = false;}}@Overrideprotected void onDraw(Canvas canvas) {canvas.drawColor(mCanvasColor);//canvas color//draw X linedrawAllXLine(canvas);if (YLineStyle.DASHES_LINE == mYLineStyle) {drawPathYDashesLine(canvas);//draw Y dashes line} else if (YLineStyle.FULL_LINE == mYLineStyle) {drawAllYLine(canvas);// draw Y line} else {noDrawYLine(canvas);}// point initmPoints = getPoints();//draw cure linedrawCurve(canvas);//draw Polygon bg colordrawPolygonBgColor(canvas);// is click pointif (null == mSelPoint) {drawDot(canvas);// draw dot} else {clickUpdateDot(canvas);// update dot after click}}private void drawCurve(Canvas c) {Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setColor(getColor(mContext, R.color.cl_c53355));p.setStrokeWidth(dip2px(1f));p.setStyle(Paint.Style.STROKE);if (mStyle == LineStyle.CURVE) {drawScrollLine(c, p);} else {drawLine(c, p);}}private void drawDot(Canvas c) {if (null == mPoints || mPoints.length == 0) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setStyle(Paint.Style.FILL);for (Point point : mPoints) {p.setColor(getColor(mContext, R.color.cl_c53355));c.drawCircle(point.x, point.y, CIRCLE_SIZE / 2f, p);p.setColor(getColor(mContext, R.color.cl_d77188));c.drawCircle(point.x, point.y, CIRCLE_SIZE / 3f, p);}}private void clickUpdateDot(Canvas c) {if (null == mPoints || mPoints.length == 0) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setStyle(Paint.Style.FILL);for (Point point : mPoints) {if (null != mSelPoint && mSelPoint.x == point.x && mSelPoint.y == point.y) {p.setColor(getColor(mContext, R.color.cl_c53355));c.drawCircle(point.x, point.y, CIRCLE_SIZE / 1.5f, p);p.setColor(getColor(mContext, R.color.cl_d77188));c.drawCircle(point.x, point.y, (CIRCLE_SIZE / 2f), p);showDialog(c, point);} else {p.setColor(getColor(mContext, R.color.cl_c53355));c.drawCircle(point.x, point.y, CIRCLE_SIZE / 2f, p);p.setColor(getColor(mContext, R.color.cl_d77188));c.drawCircle(point.x, point.y, CIRCLE_SIZE / 3f, p);}}}private void drawPolygonBgColor(Canvas c) {if (null == mPoints || mPoints.length == 0) {return;}Path p = new Path();float startX = 0;float endX = 0;int endPoint = mPoints.length - 1;for (int i = 0; i < mPoints.length; i++) {if (i == 0) {startX = mPoints[i].x;p.moveTo(mPoints[i].x, 0);p.lineTo(mPoints[i].x, mPoints[i].y);} else {p.lineTo(mPoints[i].x, mPoints[i].y);if (i == endPoint) {endX = mPoints[i].x;}}}p.lineTo(endX, (bHeight + marginTop));p.lineTo(startX, (bHeight + marginTop));p.close();Paint paint = new Paint();paint.setStyle(Paint.Style.FILL);Shader shader = null;if (mShaderOrientationStyle == ShaderOrientationStyle.ORIENTATION_H) {shader = new LinearGradient(endX, (bHeight + marginTop), startX, (bHeight + marginTop),startShaderColor, endShaderColor, Shader.TileMode.REPEAT);} else {Point point = getYBiggestPoint();if (null != point) {shader = new LinearGradient(point.x, point.y, endX, (bHeight + marginTop),startShaderColor, endShaderColor, Shader.TileMode.REPEAT);}}paint.setShader(shader);c.drawPath(p, paint);}private Point getYBiggestPoint() {Point p = null;if (null != mPoints && mPoints.length > 0) {p = mPoints[0];for (int i = 0; i < mPoints.length - 1; i++) {if (p.y > mPoints[i + 1].y) {p = mPoints[i + 1];}}}return p;}private void drawPathYDashesLine(Canvas canvas) {if (null == xRawData || xRawData.isEmpty()) {return;}Path path = new Path();int dashLength = 16;int blankLength = 16;Paint p = new Paint();p.setStyle(Paint.Style.STROKE);p.setStrokeWidth(4);p.setColor(getColor(mContext, R.color.colorGray));p.setPathEffect(new DashPathEffect(new float[]{dashLength, blankLength}, 0));for (int i = 0; i < xRawData.size(); i++) {drawTextY(xRawData.get(i), (getMarginWidth() + getBWidth() / xRawData.size() * i) - dip2px(8), bHeight + marginTop + dip2px(26),canvas);if (null != xMap) {xMap.put(xRawData.get(i), getMarginWidth() + getBWidth() / xRawData.size() * i);}int startX = (getMarginWidth() + getBWidth() / xRawData.size() * i);int startY = marginTop;int endY = bHeight + marginTop;path.moveTo(startX, startY);path.lineTo(startX, endY);canvas.drawPath(path, p);}getPointX();}/*** draw Y*/private void drawAllYLine(Canvas canvas) {if (null == xRawData || xRawData.isEmpty()) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setColor(getColor(mContext, R.color.colorBlack));for (int i = 0; i < xRawData.size(); i++) {int w = (getMarginWidth() + getBWidth() / xRawData.size()) * i;canvas.drawLine(w, marginTop, w, (bHeight + marginTop), p);drawTextY(xRawData.get(i), getMarginWidth() + getBWidth() / xRawData.size() * i - dip2px(8), bHeight + marginTop + dip2px(26),canvas);if (null != xMap) {xMap.put(xRawData.get(i), getMarginWidth() + getBWidth() / xRawData.size() * i);}}getPointX();}private void noDrawYLine(Canvas canvas) {if (null == xRawData || xRawData.isEmpty()) {return;}for (int i = 0; i < xRawData.size(); i++) {drawTextY(xRawData.get(i), (getMarginWidth() + getBWidth() / xRawData.size() * i) - dip2px(8), bHeight + marginTop + dip2px(26),canvas);if (null != xMap) {xMap.put(xRawData.get(i), getMarginWidth() + getBWidth() / xRawData.size() * i);}}getPointX();}private void getPointX() {if (null == xMap || xMap.size() == 0) {return;}if (null != pointData && !pointData.getPointInfo().isEmpty()) {for (ValuationTrackerPointData.PointInfo info : pointData.getPointInfo()) {for (Map.Entry<String, Integer> entry : xMap.entrySet()) {if (entry.getKey().equals(info.getMouth())) {xList.add(xMap.get(entry.getKey()));}}}}}/*** draw x*/private void drawAllXLine(Canvas canvas) {if (null == yRawData || yRawData.isEmpty()) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setColor(mXLinePaintColor);p.setStrokeWidth(dip2px(1f));p.setStyle(Paint.Style.FILL);int h = bHeight / spacingHeight;for (int i = 0; i < yRawData.size(); i++) {drawTextX(yRawData.get(i), marginLeft / 2,bHeight - (bHeight / spacingHeight) * i + marginTop + dip2px(2), canvas);canvas.drawLine(getMarginWidth(), (bHeight - h * i + marginTop), (canvasWidth - marginRight),(bHeight - h * i + marginTop), p);}}private void drawScrollLine(Canvas canvas, Paint paint) {if (null == mPoints || mPoints.length == 0) {return;}Point startP;Point endP;for (int i = 0; i < mPoints.length - 1; i++) {startP = mPoints[i];endP = mPoints[i + 1];int wt = (startP.x + endP.x) / 2;Point p3 = new Point();Point p4 = new Point();p3.y = startP.y;p3.x = wt;p4.y = endP.y;p4.x = wt;Path path = new Path();path.moveTo(startP.x, startP.y);path.cubicTo(p3.x, p3.y, p4.x, p4.y, endP.x, endP.y);canvas.drawPath(path, paint);}}private void drawLine(Canvas canvas, Paint paint) {if (null == mPoints || mPoints.length == 0) {return;}Point startP;Point endP;for (int i = 0; i < mPoints.length - 1; i++) {startP = mPoints[i];endP = mPoints[i + 1];canvas.drawLine(startP.x, startP.y, endP.x, endP.y, paint);}}private void drawTextY(String text, int x, int y, Canvas canvas) {if (null == yRawData || yRawData.isEmpty()) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setTextSize(dip2px(yTextSize));p.setColor(yTextPaintColor);p.setTextAlign(Paint.Align.LEFT);canvas.drawText(text, x, y, p);}private void drawTextX(String text, int x, int y, Canvas canvas) {if (null == xRawData || xRawData.isEmpty()) {return;}Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);p.setTextSize(dip2px(xTextSize));p.setColor(xTextPaintColor);p.setTextAlign(Paint.Align.LEFT);xTextWidth = (int) p.measureText(text);canvas.drawText(text, x, y, p);}private Point[] getPoints() {Point[] points = new Point[dataList.size()];for (int i = 0; i < dataList.size(); i++) {int ph = bHeight - (int) (((dataList.get(i) - pointData.getyAxisSmallValue()) / averageValue) * (bHeight * 1.0f / spacingHeight));points[i] = new Point(xList.get(i), ph + marginTop);}return points;}private int getMarginWidth() {if (xTextWidth == 0) {return marginLeft;} else {return xTextWidth + marginLeft;}}private int getBWidth() {if (xTextWidth == 0) {return bWidth;} else {return bWidth - xTextWidth;}}@SuppressLint("ClickableViewAccessibility")@Overridepublic boolean onTouchEvent(MotionEvent event) {int x = (int) event.getX();int y = (int) event.getY();int action = event.getAction();if (action == MotionEvent.ACTION_DOWN) {dealClick(x, y);}return true;}private void dealClick(int x, int y) {if (null != mPoints && mPoints.length > 0) {for (Point p : mPoints) {if ((p.x - CIRCLE_SIZE) < x && x < (p.x + CIRCLE_SIZE) &&(p.y - CIRCLE_SIZE) < y && y < (p.y + CIRCLE_SIZE)) {mSelPoint = p;invalidate();if (null != listener) {listener.onClick(this, p.x, p.y);}}}}}public void showDialog(Canvas c, Point point) {c.save();c.translate((point.x - dip2px(45f)), (point.y - dip2px(30f) - CIRCLE_SIZE / 2f));FrameLayout frameLayout = new FrameLayout(mContext);frameLayout.setLayoutParams(new ViewGroup.LayoutParams(200, 200));LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);View v = li.inflate(R.layout.dialog_valuation_tracker, null);v.setLayoutParams(newFrameLayout.LayoutParams(dip2px(90f), dip2px(26f)));frameLayout.addView(v);frameLayout.measure(bWidth, bHeight);frameLayout.layout(100, 100, 100, 100);frameLayout.draw(c);c.restore();}public void setAverageValue(int averageValue) {this.averageValue = averageValue;}public void setMarginTop(int marginTop) {this.marginTop = marginTop;}public void setMarginBottom(int marginBottom) {this.marginBottom = marginBottom;}public void setMStyle(LineStyle mStyle) {this.mStyle = mStyle;}public void setMYLineStyle(YLineStyle style) {this.mYLineStyle = style;}public void setShaderOrientationStyle(ShaderOrientationStyle shaderOrientationStyle) {this.mShaderOrientationStyle = shaderOrientationStyle;}public void setBHeight(int bHeight) {this.bHeight = bHeight;}public void setXTextPaintColor(int xTextPaintColor) {this.xTextPaintColor = xTextPaintColor;}public void setYTextPaintColor(int yTextPaintColor) {this.yTextPaintColor = yTextPaintColor;}public void setXTextSize(int xTextSize) {this.xTextSize = xTextSize;}public void setYTextSize(int yTextSize) {this.yTextSize = yTextSize;}public void setXLinePaintColor(int color) {mXLinePaintColor = color;}public void setShaderColor(int startColor, int endColor) {this.startShaderColor = startColor;this.endShaderColor = endColor;}private int dip2px(float dpValue) {float scale = mContext.getResources().getDisplayMetrics().density;return (int) (dpValue * scale + 0.5f);}public interface OnClickListener {void onClick(View v, int x, int y);}public void setListener(OnClickListener listener) {this.listener = listener;}
}

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

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

相关文章

电子产品说明书是什么?要怎么才能制作?

电子产品令人着迷&#xff0c;尤其是最新的技术&#xff0c;这就是为什么市场上充斥着各式各样的电子产品。然而&#xff0c;随着电子产品变得越来越复杂&#xff0c;如何正确、安全地使用它们变得越来越重要。这就涉及到了电子产品说明书的具体内容和如何制作。 电子产品说明书…

Thread常用的方法及线程状态原因解析

温馨提示&#xff1a;PC端观看&#xff0c;效果更佳&#xff01; 本文两大部分&#xff1a;介绍一些Thread线程常用的方法&#xff0c;和解析线程的六大状态&#xff01; 目录 一、线程常用的方法 介绍Thread类 1.开启线程 2.获取线程引用 3.休眠线程 4.中断线程 3.等待…

【ERP原理与应用】用友U8实验

实验一、系统管理与基础设置 实验内容&#xff1a; 一、核算体系的建立 好友软件公司是一家软件制造和系统集成企业&#xff0c;其产品面向国内外市场&#xff0c;自 2019 年 3 月公司开始使用 ERP 软件管理业务。软件操作员有三位&#xff0c;黄红是账套 主管&#xff0c;张…

mysql进阶知识总结

1.存储引擎 1.1MySQL体系结构 1).连接层 最上层是一些客户端和链接服务&#xff0c;包含本地sock通信和大多数基于客户端/服务端工具实现的类似于TCP/IP的通信。主要完成一些类似于连接处理、授权认证、及相关的安全方案。在该层上引入了线程池的概念&#xff0c;为通过认证…

机器学习基础——模型评估与选择(部分)

目录 一、前言&#xff1a;误差与拟合 &#xff08;一&#xff09;经验误差 &#xff08;二&#xff09;过拟合、欠拟合 二、评估方法 &#xff08;一&#xff09;评估总体的思路 &#xff08;二&#xff09;如何划分训练集和测试集 1.留出法 2.k折交叉验证 3.自助法 …

代码学习记录31---动态规划开始

随想录日记part31 t i m e &#xff1a; time&#xff1a; time&#xff1a; 2024.03.29 主要内容&#xff1a;今天开始要学习动态规划的相关知识了&#xff0c;今天的内容主要涉及四个方面&#xff1a; 理论基础 ; 斐波那契数 ;爬楼梯 ;使用最小花费爬楼梯。 理论基础 509. 斐…

SQLServer sys.default_constraints介绍

sys.default_constraints 是 SQL Server 的系统视图&#xff0c;它包含了数据库中所有默认约束的信息。默认约束是数据库对象&#xff08;如表中的列&#xff09;的约束&#xff0c;它为列定义了一个默认值&#xff0c;当在插入新行时没有为该列提供值时&#xff0c;将使用这个…

【保姆级教程】DeepLabV3+语义分割:训练自己的数据集

一、DeepLabV3图像语义分割原理 DeepLabV3架构采用扩张卷积&#xff08;也称为空洞卷积&#xff09;来捕捉多尺度信息&#xff0c;从而在不损失空间分辨率的情况下实现对图像的精细分割。 二、DeepLabV3代码及预训练权重下载 2.1 下载deeplabv3代码 这里使用的是B站大佬Bu…

axios+springboot上传图片到本地(vue)

结果&#xff1a; 前端文件&#xff1a; <template> <div> <input type"file" id"file" ref"file" v-on:change"handleFileUpload()"/> <button click"submitFile">上传</button> </div&g…

基于ssm的留学生交流互动论坛网站(java项目+文档)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于ssm的留学生交流互动论坛网站。项目源码以及部署相关请联系风歌&#xff0c;文末附上联系信息 。 项目简介&#xff1a; 留学生交流互动论坛网站…

Solana 2024 投资新风口:挖掘 DeFi、硬件开发与交易创新

将区块链的技术红利带给所有用户&#xff0c;Solana 自 2017 年诞生以来就致力于赋予开发者、消费者、投资人等各路人士的优越应用体验。在“以太坊杀手”林立的公链竞争阶段&#xff0c;Solana 凭借高性能公链的独特定位&#xff0c;朝着去中心化、安全性、低成本的目标不断精…

刷爆LeetCode:两数之和 【1/1000 第一题】

&#x1f464;作者介绍&#xff1a;10年大厂数据\经营分析经验&#xff0c;现任大厂数据部门负责人。 会一些的技术&#xff1a;数据分析、算法、SQL、大数据相关、python 作者专栏每日更新&#xff1a;LeetCode解锁1000题: 打怪升级之旅https://blog.csdn.net/cciehl/category…

设计模式之建造者模式精讲

也叫生成器模式。将一个复杂的构建与它的表示分离&#xff0c;使得同样的构建过程可以创建不同的表示。 在建造者模式中&#xff0c;有如下4个角色&#xff1a; 抽象建造者&#xff08;Builder&#xff09;&#xff1a;用于规范产品的各个组成部分&#xff0c;并进行抽象&…

c++使用类的一些注意事项

前言&#xff1a; 本篇内容为前面的补充&#xff0c;介绍了我们使用类时需要注意些什么以及一些编译器的优化&#xff0c;可能有些理解不到位或者错误&#xff0c;请斧正。 目录 前言&#xff1a; 1.再谈构造函数 2.&#xff08;c98&#xff09;隐式类型转换中的编译器的优…

Codeforces Round 934 (Div. 2) D. Non-Palindromic Substring

题目 思路&#xff1a; #include <bits/stdc.h> using namespace std; #define int long long #define pb push_back #define fi first #define se second #define lson p << 1 #define rson p << 1 | 1 const int maxn 1e6 5, inf 1e9, maxm 4e4 5; co…

【初阶数据结构】——牛客:CM11 链表分割

文章目录 1. 题目介绍2. 思路分析3. 代码实现 1. 题目介绍 链接: link 这道题是给我们一个链表和一个值X &#xff0c;要求我们以给定值x为基准将链表分割成两部分&#xff0c;所有小于x的结点排在大于或等于x的结点之前。 最终返回重新排列之后的链表的头指针。 2. 思路分析…

Redis 的慢日志

Redis 的慢日志 Redis 的慢日志&#xff08;Slow Log&#xff09;是用于记录执行时间超过预设阈值的命令请求的系统。慢日志可以帮助运维人员和开发人员识别潜在的性能瓶颈&#xff0c;定位那些可能导致 Redis 性能下降或响应延迟的慢查询。以下是 Redis 慢日志的相关细节&…

hcip综合实验2

目录 实验拓扑&#xff1a; 实验要求&#xff1a; 实验思路&#xff1a; 实验步骤&#xff1a; 1.配置设备接口IP 2.通过配置缺省路由让公网互通 3.配置ppp 1.R1和R5间的ppp的PAP认证&#xff1b; 2.R2与R5之间的ppp的CHAP认证; 3. R3与R5之间的HDLC封装; 4.构建R1、…

K8S故障处理指南:pod驱逐问题处理

更多技术博客,请关注微信公众号:运维之美 在K8S集群故障处理过程中,你可能遇到过pod的各种状态,Evicted状态代表你的K8S环境遇到了资源驱逐的问题,本节通过对驱逐问题的解决,参数的调整,问题的处理思路,希望给你解决此类问题提供帮助。 一、pod驱逐问题 pod出现状态为…

如何系统的自学python?

系统地自学Python是一个循序渐进的过程&#xff0c;以下是一份详细的指南&#xff0c;帮助你从零开始逐步掌握这门语言&#xff1a; 1、了解Python及其应用场景&#xff1a; 阅读关于Python的简介&#xff0c;理解它为何流行&#xff0c;以及在哪些领域&#xff08;如Web开发…