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.rhkb.cn/news/291967.html

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

相关文章

Mysql or与in的区别

创建一个表格 内涵一千万条数据 这张表中&#xff0c;只有id有建立索引&#xff0c;且其余都没有 测试1&#xff1a;使用or的情况下&#xff0c;根据主键进行查询 可以看到根据主键id进行or查询 花费了30-114毫秒&#xff0c;后面30多毫秒可能是因为Mysql的Buffer Pool缓冲池的…

Java并查集详解(附Leetcode 547.省份数量讲解)

一、并查集概念 并查集是一种树型的数据结构&#xff0c;用于处理一些不相交集合的合并及查询问题。 并查集的思想是用一个数组表示了整片森林&#xff08;parent&#xff09;&#xff0c;树的根节点唯一标识了一个集合&#xff0c;我们只要找到了某个元素的的树根&#xff0c;…

Unreal的Quixel Bridge下载速度过慢、下载失败

从Quixel Bridge下载MetaHuman模型&#xff0c;速度非常慢&#xff0c;而且经常下载失败&#xff0c;从头下载。 可以从Quixel Bridge的右上角我的图标->Support->Show Logs打开日志目录 downloaded-assets目录下为下载的资源 bridge-plugin.log文件记录了下载URL和下载…

Webpack生成企业站静态页面 - 项目搭建

现在Web前端流行的三大框架有Angular、React、Vue&#xff0c;很多项目经过这几年的洗礼&#xff0c;已经都 转型使用这三大框架进行开发&#xff0c;那为什么还要写纯静态页面呢&#xff1f;比如Vue中除了SPA单页面开发&#xff0c;也可以使用nuxt.js实现SSR服务端渲染&#x…

RabbitMQ基础笔记

视频链接&#xff1a;【黑马程序员RabbitMQ入门到实战教程】 文章目录 1.初识MQ1.1.同步调用1.2.异步调用1.3.技术选型 2.RabbitMQ2.1.安装2.1.1 Docker2.1.1 Linux2.1.1 Windows 2.2.收发消息2.2.1.交换机2.2.2.队列2.2.3.绑定关系2.2.4.发送消息 2.3.数据隔离2.3.1.用户管理2…

Go 之 Gin 框架

Gin 是一个 Go (Golang) 编写的轻量级 web 框架&#xff0c;运行速度非常快&#xff0c;擅长 Api 接口的高并发&#xff0c;如果项目的规模不大&#xff0c;业务相对简单&#xff0c;这个时候我们也推荐您使用 Gin&#xff0c;特别适合微服务框架。 简单路由配置 package mai…

STM32CubeIDE基础学习-USART串口通信实验(中断方式)

STM32CubeIDE基础学习-USART串口通信实验&#xff08;中断方式&#xff09; 文章目录 STM32CubeIDE基础学习-USART串口通信实验&#xff08;中断方式&#xff09;前言第1章 硬件介绍第2章 工程配置2.1 工程外设配置部分2.2 生成工程代码部分 第3章 代码编写第4章 实验现象总结 …

AMD hipcc 生成各个gpu 微架构汇编语言代码的方法示例

1&#xff0c;gpu vectorAdd 示例 为了简化逻辑&#xff0c;故假设 vector 的 size 与运行配置的thread个熟正好一样多&#xff0c;比如都是512之类的. 1.1 源码 vectorAdd.hip #include <stdio.h> #include <hip/hip_runtime.h>__global__ void vectorAdd(con…

Linux shell编程学习笔记43:cut命令

0 前言 在 Linux shell编程学习笔记42&#xff1a;md5sum 中&#xff0c;md5sum命令计算md5校验值后返回信息的格式是&#xff1a; md5校验值 文件名 包括两项内容&#xff0c;前一项是md5校验值 &#xff0c;后一项是文件名。 如果我们只想要前面的md5 校验值&#xff0c…

Golang生成UUID

安装依赖 go get -u github.com/google/uuid文档 谷歌UUID文档 示例 函数签名func NewV7() ( UUID ,错误) func (receiver *basicUtils) GenerateUUID() uuid.UUID {return uuid.Must(uuid.NewV7()) } uid : GenerateUUID()

ssm009毕业生就业信息统计系统+vue

毕业生就业信息统计系统 摘 要 随着移动应用技术的发展&#xff0c;越来越多的学生借助于移动手机、电脑完成生活中的事务&#xff0c;许多的行业也更加重视与互联网的结合&#xff0c;以提高快捷、高效、安全&#xff0c;可以帮助更多有需求的人。针对传统毕业生就业信息统计…

echarts 图表/SVG 图片指定位置截取

echarts 图表/SVG 图片指定位置截取 1.前期准备2.图片截取3.关于drawImage参数 需求&#xff1a;如下图所示&#xff0c;需要固定头部legend信息 1.前期准备 echarts dom渲染容器 <div :id"barchart id" class"charts" ref"barchart">&…

08-研发流程设计(上):如何设计Go项目的开发流程?

在Go 项目开发中&#xff0c;我们不仅要完成产品功能的开发&#xff0c;还要确保整个过程是高效的&#xff0c;代码是高质量的。 所以&#xff0c;Go 项目开发一定要设计一个合理的研发流程&#xff0c;来提高开发效率、减少软件维护成本。研发流程会因为项目、团队和开发模式…

微信开发者工具接入短剧播放器插件

接入短剧播放插线 申请添加插件基础接入app.jsonapp.jsplayerManager.js数据加密跳转到播放器页面运行出错示例小程序页面页面使用的方法小程序输入框绑定申请添加插件 添加插件:登录微信开发者平台 ——> 设置 ——> 第三方设置 ——> 插件管理 ——> 搜索“短剧…

基于SpringBoot + Vue实现的校园失物招领系统设计与实现+毕业论文

介绍 系统包含用户和管理员两个角色 用户&#xff1a;登录、注册、留言板、公告信息、失物招领、失物认领、寻物启事、个人中心、我发布的失物信息、我的失物认领、我发布的寻物启事、寻物启事留言等功能。 管理员&#xff1a;登录、基础数据管理、系统管理、留言板管理、失物信…

Docker数据卷挂载

一、容器与数据耦合的问题: 数据卷是虚拟的&#xff0c;不真实存在的&#xff0c;它指向文件中的文件夹 &#xff0c;属主机文件系统通过数据卷和容器数据进行联系&#xff0c;你改变我也改变。 解决办法&#xff1a; 对宿主机文件系统内的文件进行修改&#xff0c;会立刻反应…

Spring官方真的不建议使用属性进行依赖注入吗?

使用Spring进行依赖注入时&#xff0c;很多大佬都推荐使用构造方法注入&#xff0c;而非使用在属性上添加 Autowired 注入&#xff0c;而且还说这是Spring官方说的&#xff0c;真的是这样吗&#xff1f; 使用Spring进行依赖主要的方式有很多&#xff0c;主流的使用方式有两种&a…

微服务高级篇(五):可靠消息服务

文章目录 一、消息队列MQ存在的问题&#xff1f;二、如何保证 消息可靠性 &#xff1f;2.1 生产者消息确认【对生产者配置】2.2 消息持久化2.3 消费者消息确认【对消费者配置】2.4 消费失败重试机制2.5 消费者失败消息处理策略2.6 总结 三、处理延迟消息&#xff1f;死信交换机…

系统需求分析报告(原件获取)

第1章 序言 第2章 引言 2.1 项目概述 2.2 编写目的 2.3 文档约定 2.4 预期读者及阅读建议 第3章 技术要求 3.1 软件开发要求 第4章 项目建设内容 第5章 系统安全需求 5.1 物理设计安全 5.2 系统安全设计 5.3 网络安全设计 5.4 应用安全设计 5.5 对用户安全管理 …

一文带你深刻了解控制台console那些事

一、前言 首先感谢小伙伴们访问我的博客&#xff0c;但是你是有多么的无聊才会选择打开我的控制台呢&#xff1f;不过还是很感谢大家通过邮件的形式&#xff0c;给我提出很多的宝贵意见。 借此机会正好和大家唠一唠前端console到底有什么魔法。 二、console.log调试必备 consol…