【问题标题】:Xamarin.Forms MicroCharts how to add multiple values to LabelXamarin.Forms MicroCharts 如何将多个值添加到标签
【发布时间】:2020-02-28 10:41:49
【问题描述】:

我正在使用我从 API 读取的数据跟踪 GitHub 上关于微图表的起始代码:

    List<Entry> entries = new List<Entry>  
        {  
            new Entry(200)  
            {  
                Color=SKColor.Parse("#FF1943"),  
                Label ="January",  
                ValueLabel = "200"  
            },  
            new Entry(400)  
            {  
                Color = SKColor.Parse("00BFFF"),  
                Label = "March",  
                ValueLabel = "400"  
            },  
            new Entry(-100)  
            {  
                Color =  SKColor.Parse("#00CED1"),  
                Label = "Octobar",  
                ValueLabel = "-100"  
            },  
            };  

是否可以在 ValueLabel 中添加 2-3 个值?我正在尝试模拟条形图多个系列

【问题讨论】:

  • 阿斯塔答案??或者只是编辑

标签: xamarin xamarin.forms xamarin.android xamarin.ios


【解决方案1】:

根据我的测试,我无法通过 MicroCharts BarChart 添加多个系列。您可以使用 OxyPlot。

按照此链接中的代码进行操作。 Bar/Linear chart with multiple entries in Xamarin Forms

从 NuGet 包管理器安装 OxyPlot.Xamarin.Forms

将以下代码添加到 MainActivity.cs

OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();

您可以从下面的链接下载源代码。 https://forums.xamarin.com/discussion/comment/402658#Comment_402658

【讨论】:

  • 我用 oxyplot 制作,但它无限缩小,设计不太好
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多