标签: oxyplot

OxyPlot:ColumnSeries/BarSeries显示每列的值

在我的WPF应用程序中,我使用OxyPlot.我将我的数据绑定到PlotModel,一切运行良好.

我想在图表上显示每列的值.可能吗?

作为参考,这个BarSeries现场示例,我希望分别显示2009年,2010年和2011年苹果的实际价值.即2009Apples列的Value1值,2010Apples的Value2值等.

我查看了BarSeries的API(对于可互换使用的WPF ColumnSeries).Bar和其他图表的教程.但无法在任何地方找到这样的东西.

我该如何实现这一目标?

wpf stackedbarseries oxyplot

4
推荐指数
1
解决办法
6630
查看次数

OxyPlot获得点击点

我试图通过以下方式在散点图上绘制一些圆圈:

<Grid>
    <oxy:PlotView x:Name="PlotView" Title="{Binding Title}" >
        <oxy:PlotView.Axes>
            <oxy:LinearAxis Position="Bottom" Minimum="-30" Maximum="30" IsAxisVisible="False" IsZoomEnabled="False" IsPanEnabled="False" />
            <oxy:LinearAxis Position="Left" Minimum="0" Maximum="35" IsAxisVisible="False" IsZoomEnabled="False" IsPanEnabled="False"/>
        </oxy:PlotView.Axes>
        <oxy:PlotView.Series>
            <oxy:ScatterSeries Height="100" Width="100" ItemsSource="{Binding Points}" MarkerType="Circle" />
        </oxy:PlotView.Series>
    </oxy:PlotView>
</Grid>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何启用某种点击处理程序,以便在用户点击DataPoint时触发事件.

〔实施例:

用户在X:0,Y:5点击数据点,我想触发一个事件,以便我可以处理该点的点击.

这可能与OxyPlot有关吗?我目前正在调查跟踪器,看看它是否可能是这条路线,但是开始耗尽这些想法.

c# wpf oxyplot

4
推荐指数
1
解决办法
7767
查看次数

Oxyplot:如何设置简单的柱形图

我必须在WPF项目中实现一个简单的柱形图输出.我为它选择了OxyPlot库.设计模式当然是MVVM.相关的源代码部分可以在下面看到.我得到的,当我运行项目时是一个空图表,x轴上的类别为1到5(这是正确的),y轴上的值为0到100(这也是正确的,因为我应该显示百分比) .

数据集合(类别轴的"难点"和值轴的"百分比")正确填充了值,我检查了一个.

但是没有显示任何列.所以我想知道我做错了什么.我根据这个oxyplot演示构建了我的示例,并基于我们在大学的wpf课程中提供的示例.

有什么建议?

关心罗兰

using System;
using System.ComponentModel;
using System.Linq.Expressions;

namespace GeoCaching.Wpf.ViewModels
{
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }

        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                Console.WriteLine("PropertyChangedEventArgs called " + propertyName);
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

统计模型本身就在这里:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml oxyplot

3
推荐指数
1
解决办法
7059
查看次数

Oxyplot 中具有共享轴的多个图

我想使用 OXYPLOT 库添加多个共享 x 轴的图。示例代码如下,它设置了 4 个不同的 y 轴共享相同的 x 轴。但是我只能在第一个 x&y 轴上绘制数据,而不能在其他轴上绘制数据。任何形式的建议将不胜感激。

    [Example("Untitled")]
    public static PlotModel Untitled()
    {
        var plotModel1 = new PlotModel();
        plotModel1.PlotMargins = new OxyThickness(40,20,40,30);
        var linearAxis1 = new LinearAxis();
        linearAxis1.EndPosition = 0.25;
        linearAxis1.Maximum = 1;
        linearAxis1.Minimum = -1;
        linearAxis1.Title = "C1";
        linearAxis1.Key= "C1";
        plotModel1.Axes.Add(linearAxis1);
        var linearAxis2 = new LinearAxis();
        linearAxis2.EndPosition = 0.5;
        linearAxis2.Maximum = 1;
        linearAxis2.Minimum = -1;
        linearAxis2.Position = AxisPosition.Right;
        linearAxis2.StartPosition = 0.25;
        linearAxis2.Title = "C2";
        linearAxis2.Key= "C2";
        plotModel1.Axes.Add(linearAxis2);
        var linearAxis3 = new LinearAxis();
        linearAxis3.EndPosition …
Run Code Online (Sandbox Code Playgroud)

c# oxyplot

3
推荐指数
1
解决办法
6133
查看次数

如何向OxyPlot添加新点?

这是Oxyplot官方页面显示的代码.名称空间WpfApplication2

{
    using System.Collections.Generic;

    using OxyPlot;

    public class MainViewModel
    {
        public MainViewModel()
        {
            this.Title = "Example 2";
            this.Points = new List<DataPoint>
                              {
                                  new DataPoint(0, 4),
                                  new DataPoint(10, 13),
                                  new DataPoint(20, 15),
                                  new DataPoint(30, 16),
                                  new DataPoint(40, 12),
                                  new DataPoint(50, 12)
                              };
        }

        public string Title { get; private set; }

        public IList<DataPoint> Points { get; private set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是XAML

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:oxy="http://oxyplot.codeplex.com"
        xmlns:local="clr-namespace:WpfApplication2"
        Title="Example 2 (WPF)" Height="350" Width="525">
    <Window.DataContext>
        <local:MainViewModel/>
    </Window.DataContext>
    <Grid>
        <oxy:Plot Title="{Binding Title}">
            <oxy:Plot.Series> …
Run Code Online (Sandbox Code Playgroud)

c# wpf oxyplot

3
推荐指数
1
解决办法
9663
查看次数

如何更改OxyPlot Y-Axis字符串格式?

谁能告诉我如何更改Y轴字符串格式?

我有Y轴百分比,我想添加百分号.

我正在使用OxyPlot在wpf中生成图表.

这是我的尝试,但它不起作用:

Func<double, string> formatFunc = (x) => string.Format("{000.00}%", x);

        formatFunc = new Func<double,string>("{0}");
        // Add the plot to the window
        line.YAxis.LabelFormatter = formatFunc;
Run Code Online (Sandbox Code Playgroud)

这会产生空引用错误.

谢谢!

c# wpf oxyplot

3
推荐指数
1
解决办法
6434
查看次数

如何在 xamarin.android 中使用 oxyplot 创建甜甜圈图?

我需要创建显示像 Highcharts 这样的图表的应用程序。但我没有得到任何图书馆。所以我使用 oxyplot 创建图表。我已经使用这样的 oxyplot 创建了饼图。

var plotView = new PlotView (this);
        plotView.Model = PieViewModel();

        this.AddContentView (plotView,
            new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));



        public PlotModel PieViewModel()
    {
        var modelP1 = new PlotModel { Title = "Pie Sample1" };
        dynamic seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 };
        seriesP1.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false, Fill = OxyColors.PaleVioletRed });
        seriesP1.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true });
        seriesP1.Slices.Add(new PieSlice("Asia", 4157) { IsExploded …
Run Code Online (Sandbox Code Playgroud)

charts highcharts xamarin.android oxyplot

3
推荐指数
1
解决办法
1739
查看次数

OxyPlot:如何使用轴标签格式化器并显示Y标签?

我正在使用Oxyplot为我的Xamarin.iOS项目绘制条形图..

这是我的图表目前看起来喜欢的

在此输入图像描述

这里是x轴值而不是数字,我想显示太阳,mon true,wed .....

我可以看到CategoryAxis有一个名为LabelFormatter的方法返回Func<double, string>,但我该如何使用它呢?

还有为什么Y轴标签没有显示???

public class MyClass
{
    /// <summary>
    /// Gets or sets the plot model that is shown in the demo apps.
    /// </summary>
    /// <value>My model.</value>
    public PlotModel MyModel { get; set; }

    /// <summary>
    /// Initializes a new instance of the <see cref="OxyPlotSample.MyClass"/> class.
    /// </summary>
    public MyClass()
    {

        var model = new PlotModel { Title = "ColumnSeries" };
        model.PlotAreaBorderColor = OxyColors.Transparent;
        // A ColumnSeries requires a CategoryAxis on the …
Run Code Online (Sandbox Code Playgroud)

c# xamarin.ios oxyplot

3
推荐指数
1
解决办法
6665
查看次数

在 OxyPlot 线系列中添加间隙

我在 Xamarin 表单应用程序中使用 OxyPlot。在一个线系列中可能会有缺失的数据,我需要在线条中有一个间隙来指示缺失的数据。

这是我想要实现的一个例子:

在javascript中使用flot创建的绘图。 在值中显示“洞”

我怎样才能创建一个包含这样的差距的图表?

c# oxyplot

3
推荐指数
1
解决办法
887
查看次数

如何禁用饼图中的标签和线条?

实际上,我正在尝试删除标签和通向标签的线。该应用程序使用 C#,我使用 OxyPlot 绘制饼图。

这是我的代码。正如你所看到的,我所尝试的一切都没有帮助我。

谢谢你的帮助!

public class MyViewModel
{
    public PlotModel MyModel { get; set; }

    public MyViewModel()
    {

        SingletonItem singletonItem = SingletonItem.Instance;

        PieSeries pieSeries = new PieSeries();

        pieSeries.Slices.Add(new PieSlice("Done", singletonItem.Done) {IsExploded = true, Fill = OxyColors.PaleVioletRed});
        pieSeries.Slices.Add(new PieSlice("Undone", singletonItem.Undone) {IsExploded = true});

        pieSeries.LabelField = "";
        pieSeries.TickDistance = 0;
        pieSeries.ValueField = "";
        MyModel = new PlotModel();
        MyModel.IsLegendVisible = false;
        MyModel.Series.Add(pieSeries);
    }
}
Run Code Online (Sandbox Code Playgroud)

实际页面截图

c# xamarin oxyplot

3
推荐指数
1
解决办法
1432
查看次数