BootstrapBlazor 是一套基于 Bootstrap 和 Blazor 的企业级组件库,无缝整合了 Bootstrap 框架与 Blazor 技术。它提供了一整套强大的工具,使开发者能够轻松创建响应式和交互式的 Web 应用程序。

项目地址

Gitee:https://gitee.com/LongbowEnterprise/BootstrapBlazor

GitHub:https://github.com/dotnetcore/BootstrapBlazor

Nuget:https://www.nuget.org/packages/BootstrapBlazor

Blazor 使用 Mermaid 渲染详细图表

安装项目模板

dotnet new install Bootstrap.Blazor.Templates::*

新建项目,使用任意渲染模式模板,如果要在已有项目中使用Mermaid组件,则需要添加BootstrapBlazor包引用

安装可选包

Mermaid组件不包括在核心组件库BootstrapBlazor.Components中,需要使用Nuget安装BootstrapBlazor.Mermaid

dotnet add package BootstrapBlazor.Mermaid

编写UI代码

<Mermaid DiagramString="@CustomStyleString"></Mermaid>
private string CustomStyleString { get; } = """
flowchart LR
A[start] -->
B{Whether the conditions are met?}
B -- yes --> C[Perform tasks 1]
B -- no --> D[Perform tasks 2]
C --> E{Condition checks}
D --> E
E -- The conditions are established --> F[Sub-processes]
F --> G[Complete the subprocess]
E -- The condition failed --> H[Error handling]
H --> I[Keep a log]
G --> J[end]
I --> J style A fill:#ffe0b3,stroke:#ff9900,stroke-width:2px;
style B fill:#ffcccc,stroke:#ff0000,stroke-width:2px;
style C fill:#e6ffcc,stroke:#009933,stroke-width:2px;
style D fill:#cce6ff,stroke:#0033cc,stroke-width:2px;
style E fill:#ffccff,stroke:#9900cc,stroke-width:2px;
style F fill:#ccccff,stroke:#3300cc,stroke-width:2px;
style G fill:#b3ffff,stroke:#00cccc,stroke-width:2px;
style H fill:#ffd9b3,stroke:#ff6600,stroke-width:2px;
style I fill:#d9d9d9,stroke:#808080,stroke-width:2px;
style J fill:#ccffcc,stroke:#009900,stroke-width:2px; linkStyle 0 stroke:#00cc00,stroke-width:2px;
linkStyle 1 fill:#006600,stroke:#009933,stroke-width:2px,font-size:12px;
linkStyle 2 fill:#990000,stroke:#ff3300,stroke-width:2px,font-size:12px;
linkStyle 3 stroke:#ff33cc,stroke-width:2px;
linkStyle 4 stroke:#cc33ff,stroke-width:2px;
linkStyle 5 stroke:#33ccff,stroke-width:2px;
linkStyle 6 stroke:#ff6600,stroke-width:2px,stroke-dasharray: 10,10;
linkStyle 7 stroke:#999999,stroke-width:2px;
linkStyle 8 stroke:#009900,stroke-width:2px;
linkStyle 9 stroke:#ff6600,stroke-width:2px;
""";

效果图

#bb_64469555-svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#bb_64469555-svg .error-icon{fill:#552222;}#bb_64469555-svg .error-text{fill:#552222;stroke:#552222;}#bb_64469555-svg .edge-thickness-normal{stroke-width:1px;}#bb_64469555-svg .edge-thickness-thick{stroke-width:3.5px;}#bb_64469555-svg .edge-pattern-solid{stroke-dasharray:0;}#bb_64469555-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#bb_64469555-svg .edge-pattern-dashed{stroke-dasharray:3;}#bb_64469555-svg .edge-pattern-dotted{stroke-dasharray:2;}#bb_64469555-svg .marker{fill:#333333;stroke:#333333;}#bb_64469555-svg .marker.cross{stroke:#333333;}#bb_64469555-svg svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#bb_64469555-svg p{margin:0;}#bb_64469555-svg .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#bb_64469555-svg .cluster-label text{fill:#333;}#bb_64469555-svg .cluster-label span{color:#333;}#bb_64469555-svg .cluster-label span p{background-color:transparent;}#bb_64469555-svg .label text,#bb_64469555-svg span{fill:#333;color:#333;}#bb_64469555-svg .node rect,#bb_64469555-svg .node circle,#bb_64469555-svg .node ellipse,#bb_64469555-svg .node polygon,#bb_64469555-svg .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#bb_64469555-svg .rough-node .label text,#bb_64469555-svg .node .label text,#bb_64469555-svg .image-shape .label,#bb_64469555-svg .icon-shape .label{text-anchor:middle;}#bb_64469555-svg .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#bb_64469555-svg .rough-node .label,#bb_64469555-svg .node .label,#bb_64469555-svg .image-shape .label,#bb_64469555-svg .icon-shape .label{text-align:center;}#bb_64469555-svg .node.clickable{cursor:pointer;}#bb_64469555-svg .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#bb_64469555-svg .arrowheadPath{fill:#333333;}#bb_64469555-svg .edgePath .path{stroke:#333333;stroke-width:2.0px;}#bb_64469555-svg .flowchart-link{stroke:#333333;fill:none;}#bb_64469555-svg .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#bb_64469555-svg .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#bb_64469555-svg .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#bb_64469555-svg .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#bb_64469555-svg .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#bb_64469555-svg .cluster text{fill:#333;}#bb_64469555-svg .cluster span{color:#333;}#bb_64469555-svg div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#bb_64469555-svg .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#bb_64469555-svg rect.text{fill:none;stroke-width:0;}#bb_64469555-svg .icon-shape,#bb_64469555-svg .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#bb_64469555-svg .icon-shape p,#bb_64469555-svg .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#bb_64469555-svg .icon-shape rect,#bb_64469555-svg .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#bb_64469555-svg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

yes

no

The conditions are established

The condition failed

start

Whether the conditions are met?

Perform tasks 1

Perform tasks 2

Condition checks

Sub-processes

Complete the subprocess

Error handling

Keep a log

end

JohnBobAliceJohnBobAlice#bb_50804827-svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#bb_50804827-svg .error-icon{fill:#552222;}#bb_50804827-svg .error-text{fill:#552222;stroke:#552222;}#bb_50804827-svg .edge-thickness-normal{stroke-width:1px;}#bb_50804827-svg .edge-thickness-thick{stroke-width:3.5px;}#bb_50804827-svg .edge-pattern-solid{stroke-dasharray:0;}#bb_50804827-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#bb_50804827-svg .edge-pattern-dashed{stroke-dasharray:3;}#bb_50804827-svg .edge-pattern-dotted{stroke-dasharray:2;}#bb_50804827-svg .marker{fill:#333333;stroke:#333333;}#bb_50804827-svg .marker.cross{stroke:#333333;}#bb_50804827-svg svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#bb_50804827-svg p{margin:0;}#bb_50804827-svg .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#bb_50804827-svg text.actor>tspan{fill:black;stroke:none;}#bb_50804827-svg .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#bb_50804827-svg .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#bb_50804827-svg .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#bb_50804827-svg #arrowhead path{fill:#333;stroke:#333;}#bb_50804827-svg .sequenceNumber{fill:white;}#bb_50804827-svg #sequencenumber{fill:#333;}#bb_50804827-svg #crosshead path{fill:#333;stroke:#333;}#bb_50804827-svg .messageText{fill:#333;stroke:none;}#bb_50804827-svg .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#bb_50804827-svg .labelText,#bb_50804827-svg .labelText>tspan{fill:black;stroke:none;}#bb_50804827-svg .loopText,#bb_50804827-svg .loopText>tspan{fill:black;stroke:none;}#bb_50804827-svg .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#bb_50804827-svg .note{stroke:#aaaa33;fill:#fff5ad;}#bb_50804827-svg .noteText,#bb_50804827-svg .noteText>tspan{fill:black;stroke:none;}#bb_50804827-svg .activation0{fill:#f4f4f4;stroke:#666;}#bb_50804827-svg .activation1{fill:#f4f4f4;stroke:#666;}#bb_50804827-svg .activation2{fill:#f4f4f4;stroke:#666;}#bb_50804827-svg .actorPopupMenu{position:absolute;}#bb_50804827-svg .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#bb_50804827-svg .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#bb_50804827-svg .actor-man circle,#bb_50804827-svg line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#bb_50804827-svg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}loop[HealthCheck]Rational thoughts prevail!Hello John, how are you?Fight against hypochondriaGreat!How about you?Jolly good!Title SequenceDiagram

结语

组件支持导出Base64数据(ExportBase64MermaidAsync),后续会实现双绑事件

更多Mermaid语法,参考:https://mermaid.nodejs.cn/intro/

[BootstrapBlazor] Blazor 使用 Mermaid 渲染详细图表的更多相关文章

  1. Vue自定义标签页,并且在其中渲染Echarts图表

    目录 一.需求说明 二.标签页功能实现 一.需求说明 1.点击标签按钮切换不同的echarts图表,考虑用Ant Design Vue,但是其样式无法自定义 2.div的整体布局样式使用tailwin ...

  2. mpvue——动态渲染echarts图表

    前言 使用mpvue-echarts来写图表,那个F2再提醒自己下要踩坑不能忘记.遇到了一个问题就是数据不能动态的去渲染,这个其实官方给了我们对应的方法 懒加载 代码 修改了调用initChart() ...

  3. 关于在bootstrap的tab栏中渲染echats图表,切换tab时echats不显示问题

    在开发过程中遇到这样个问题: 利用bootstrap中的tab栏,每当点击tab栏的导航时,echats仅仅只渲染第一个tab的内容,切换tab时,echats图表不显示. 其html代码为: < ...

  4. v-if和updated钩子结合使用 渲染echart图表

    项目需求是这样的,用户可以自定选择echart 曲线图 是横向还是竖向显示.我的做法是 写了一个横向的echart图表,也写了一个竖向的echart图表,然后两者共用存在store里的图表数据,就能实 ...

  5. 浏览器渲染详细过程:重绘、重排和 composite 只是冰山一角

    https://juejin.im/entry/590801780ce46300617c89b8 渲染 这张很经典的图许多人都看过,其中的概念大家应该都很熟悉,也就是这么几个步骤:js修改dom结构或 ...

  6. jQuery插件jqplot的详细配置说明和渲染器

    jQuery插件jqplot的详细配置说明和渲染器 (2012-08-23 08:57:42) 转载▼ 标签: jqplot 详细配置 渲染器 it 分类: 技术类 jQuery.jqplot插件的官 ...

  7. FusionCharts可使用JavaScript渲染iPhone/iPod/iPad图表

    FusionCharts使用JavaScript: FusionCharts允许用户创建建立JavaScript图表(也就是web上的HTML5 /Canvas图表).这个特性允许用户在不支持Flas ...

  8. 11个很棒的 jQuery 图表库

    如果你曾经使用过任何类型的数据,你应该知道阅读一排排数据的痛苦.通过所有这些数据弄清楚他们的意思是非常不容易的.可视化对于解决这个问题起到了重要的作用.可视化降低了数据阅读的难度,帮助决策者获得可操作 ...

  9. Android 图表绘制 achartengine 示例解析

    一. AChartEngine 简介 1. 项目地址 AChartEngine 简介 : AChartEngine 是 Android 平台的图表开发库, 能绘制 折线图, 饼图, 气泡图, 柱状图, ...

  10. 【Android 应用开发】Android 图表绘制 achartengine 示例解析

    作者 : 韩曙亮 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/38420197 一. AChartEngine 简介 1. 项 ...

随机推荐

  1. ftrace irqs跟踪器

    当中断被关闭(俗称关中断)了,CPU就不能响应其他的事件,如果这时有一个鼠标中断,要在下一次开中断时才能响应这个鼠标中断,这段延迟称为中断延迟.向current_tracer 文件写入 irqsoff ...

  2. Exchange2016虚拟目录介绍

    Exchange2016虚拟目录介绍 Autodiscover 允许Outlook自动发现邮箱设置,以便用户无需手动配置Outlook的高级设置. ecp 用于访问EAC. EWS 提供如服务可用性, ...

  3. Kubernetes 持久化存储之 NFS 终极实战指南

    作者:运维有术星主 在 Kubernetes 生态系统中,持久化存储扮演着至关重要的角色,它是支撑应用稳定运行的基石.对于那些选择自建 Kubernetes 集群的运维架构师而言,选择合适的后端持久化 ...

  4. 使用 Prometheus 在 KubeSphere 上监控 KubeEdge 边缘节点(Jetson) CPU、GPU 状态

    作者:朱亚光,之江实验室工程师,云原生/开源爱好者. KubeSphere 边缘节点的可观测性 在边缘计算场景下,KubeSphere 基于 KubeEdge 实现应用与工作负载在云端与边缘节点的统一 ...

  5. 使用 KubeSphere 实现微服务的灰度发布

    前言 今天来说一说,在 KubeSphere 中两个 " 小姐姐 " 如何来回切换,这是什么意思哩?其实就是互联网产品中常用的灰度发布方式. 互联网产品需要快速迭代上线,既要保证新 ...

  6. Windows电脑无法给airpods充电的解决办法

    耳机盒与电脑都有TYPEC接口,由于驱动问题,接在一起是充不了电的,需要更改设置解决: 打开设置 -> 蓝牙与其他设备 -> 显示更多设备 往下翻,找到"更多设备与打印机设置&q ...

  7. 彻底理解spring框架当中的依赖注入(DI)与控制反转(IOC)理念

    什么是依赖注入 人生当中第一次听说到这个概念是在spring框架的学习当中,当然依赖注入并不局限于spring,其实依赖注入早已不是一个新鲜词,而是一个犹如古董般的设计理念,但是我还年轻呐那么就从这里 ...

  8. NDT论文翻译

    The Normal Distributions Transform: A New Approach to Laser Scan Matching 正态分布变换:激光扫描匹配的新方法 摘要:匹配 2D ...

  9. 为什么我越来越喜欢用DDD — DDD架构篇(1)

    Hello DDD DDD 是一种软件设计方法,DDD 是指导我们做软件工程设计的一种手段.它提供了用切割工程模型的各类技巧,如:领域.界限上下文.实体.值对象.聚合.工厂.仓储等.通过 DDD 的指 ...

  10. 基于HarmonyOS NEXT 5.0自定义增强版导航栏组件|鸿蒙ArkUI自定义标题栏

    这段时间比较热门的莫过于华为推出的自主研发的面向全场景分布式操作系统HarmonyOS. https://developer.huawei.com/ 最新一直潜心学习鸿蒙os开发,于是基于Harmon ...