我如何使用livecharts库? [英] How do I use the livecharts library?

查看:1076
本文介绍了我如何使用livecharts库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想创建这样的东西。



视觉表示



使用此工具https://lvcharts.net/



我已经有数据要添加到图表但我不知道该图表被调用或如何使用它,我试图在网站上寻找文档,这将帮助我这个特定的图形,但我找不到任何东西。任何人都可以通过显示一个工作示例的代码片段来帮助我,所以我知道如何使用它?我已经将nuget包添加到我的项目中,并添加了所有控件。根据我的理解,你需要将控件绑定到一个通用集合,比如更新或类似的列表。



我尝试过:



我试过看他们的网站但是无法理解它。

So I wanted to create something like this.

Visual representation

Using this tool https://lvcharts.net/

I already have the data to add to the graph but I have no idea what that graph is called or how to use it, I tried looking for docs on the website that would help me with this specific graph but I couldnt find anything. Could anyone help me by showing a code snippet of a working example so I know how to use it? I already added the nuget package to my project and I have all the controls added. From what I understand you need to bind the control to a generic collection like a list that updates or something like that.

What I have tried:

I've tried looking at their website but couldnt make sense of it.

推荐答案

但是,您需要在网站上找到所有内容:实时图表 [ ^ ]



1 。转到解决方案资源管理器,右键单击引用,然后管理NuGet包。

2.浏览LiveCharts.Wpf,选择包并单击安装

3.添加XAML的命名空间



But there is all that you need on the website: Live Charts[^]

1. Go to Solution Explorer, right click on references, then Manage NuGet Packages.
2. Browse for LiveCharts.Wpf, select the package and click on install
3. Add namespace to your XAML

xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"





代码背后的必要条件ry



And to code behind if necessary

using LiveCharts;
using LiveCharts.Wpf;





4.Code Behind





4.Code Behind

SeriesCollection = new SeriesCollection
    {
        new LineSeries
        {
            Values = new ChartValues<double> { 3, 5, 7, 4 }
        },
        new ColumnSeries                
        {
            Values = new ChartValues<decimal> { 5, 6, 2, 7 }
        }
    };





5 .XAML





5. XAML

<lvc:CartesianChart Series="{Binding SeriesCollection}" />


这篇关于我如何使用livecharts库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆