8 Star 53 Fork 15

算神 / Blazor.ECharts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Blazor.ECharts

介绍

Blazor版本的ECharts图表组件

重新出发

本项目源自https://github.com/caopengfei/BlazorECharts,由于原作者有好长一段时间没有更新和处理PR,故在此基础上,重新做了这个

GitHub license

开源地址:https://github.com/lishewen/Blazor.ECharts

国内镜像:https://gitee.com/lishewen/Blazor.ECharts

ECharts配置请参考:

https://echarts.apache.org/examples/zh/index.html

使用方式

  1. 创建Blazor项目。
  2. 在NuGet中安装包Blazor.ECharts NuGet downloads
  3. _Imports.razor中添加@using Blazor.ECharts.Components
  4. wwwroot/index.html文件的Head中引入:
<script src="https://lib.baomitu.com/echarts/5.3.3/echarts.min.js"></script>

需要使用地图相关功能的则需要额外添加地图js的引用

<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=[Your Key Here]"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/bmap.min.js"></script>
  1. wwwroot/index.html文件的Body中引入:
<script type="module" src="_content/Blazor.ECharts/core.js"></script>
  1. 修改Program.cs增加
builder.Services.AddECharts();
  1. 在页面中使用组件(可参考Demo项目)。

注意:因为没有设置默认的样式,所以需要在组件上设置Class或者Style来控制宽度和高度

Demo中也提供示范样式

.chart-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-left: 20px;
    padding-bottom: 20px;
    padding-right: 0px;
    padding-top: 0px;
    height: 95%;
    width: 95%;
}

.chart-normal {
    border-radius: 4px;
    height: 300px;
    width: 400px;
    margin-top: 20px;
}

.chart-fill {
    width: 100%;
    height: 720px;
    margin-top: 20px;
    margin-right: 20px;
}

JS function的输出问题

由于function不是json的标准数据类型,所以json数据中若含function,则转换后,function会丢失。此库为解决这个问题通过JFuncConverter来实现转译输出。使用时传入一个JFunc对象即可。例如:

Position = new JFunc()
{
    RAW = """
    function (pt) {
        return [pt[0], '10%'];
    }
    """
}

功能实现进度

  • 公共配置
    • title
    • legend
    • grid(部分)
    • xAxis(部分)
    • yAxis(部分)
    • polar(部分)
    • radiusAxis(部分)
    • angleAxis(部分)
    • radar(部分)
    • dataZoom
    • visualMap(部分)
    • tooltip(部分)
    • axisPointer(部分)
    • toolbox(部分)
    • brush
    • geo
    • parallel
    • parallelAxis
    • singleAxis
    • timeline
    • graphic
    • calendar
    • dataset
    • aria
    • series(部分)
    • color
    • backgroundColor
    • textStyle
    • animation
    • animationThreshold
    • animationDuration
    • animationEasing
    • animationDelay
    • animationDurationUpdate
    • animationEasingUpdate
    • animationDelayUpdate
    • blendMode
    • hoverLayerThreshold
    • useUTC
  • 图表
    • 折线图(部分)
    • 柱状图(部分)
    • 饼图(部分)
    • 散点图(部分)
    • 地理坐标/地图(部分)
    • K线图(部分)
    • 雷达图(部分)
    • 盒须图
    • 热力图
    • 关系图(部分)
    • 路径图(部分)
    • 树图(部分)
    • 矩形树图(部分)
    • 旭日图(部分)
    • 平行坐标系
    • 桑基图(部分)
    • 漏斗图(部分)
    • 仪表盘(部分)
    • 象形柱图
    • 主题河流图
    • 日历坐标系
    • 词云图(使用方法:Blazor.ECharts.WordCloud/README.md)

Nuget Package中没有打包echarts.js的原因

  1. 减少包的体积
  2. 方便自由更换cdn
  3. 方便echarts小版本更新时,作者没有来得及更新Package内的js时,可自行在页面上更换
MIT License Copyright (c) 2021 算神 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Blazor版本的ECharts图表组件 展开 收起
C# 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/lishewen/Blazor.ECharts.git
git@gitee.com:lishewen/Blazor.ECharts.git
lishewen
Blazor.ECharts
Blazor.ECharts
master

搜索帮助