logo
为了能更好地了解您的商业使用需求,请参与 Ant Design Blazor 商业应用调查,一起建设商业应用社区,为企业系统研发赋能!

Introduce介绍

Ant Design Charts Blazor 图表库基于 G2Plot 开发,

GitHub: https://github.com/ant-design-blazor/ant-design-charts-blazor

📦 安装

  • 进入应用的项目文件夹,安装 NuGet 包引用

    $ dotnet add package AntDesign.Charts
    
  • wwwroot/index.html(WebAssembly) 或 Pages/_Host.razor(Server) 中引入静态文件:

    <script src="_content/AntDesign.Charts/g2plot.min.js"></script>
    <script src="_content/AntDesign.Charts/ant-design-charts-blazor.js"></script>
    
  • _Imports.razor 中加入命名空间

    @using AntDesign.Charts
    
  • 最后就可以在.razor组件中引用啦!

    <Line Data="data" Config="config" />
    
    @code {
        object[] data = new object[] {
            new  { year = "1991", value = 3 },
            new  { year = "1992", value = 4 },
            new  { year = "1993", value = 3.5 },
            new  { year = "1994", value = 5 },
            new  { year = "1995", value = 4.9 },
            new  { year = "1996", value = 6 },
            new  { year = "1997", value = 7 },
            new  { year = "1998", value = 9 },
            new  { year = "1999", value = 13 },
        };
    
        LineConfig config = new LineConfig()
            {
                Padding = "auto",
                XField = "year",
                YField = "value",
                Smooth = true,
            };
    }
    

🔗 链接

🤝 如何贡献

PRs Welcome

如果你希望参与贡献,欢迎 Pull Request,或给我们 报告 Bug

文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.