Domanda

So far, I tried Oxyplot and official example from here http://oxyplot.codeplex.com/wikipage?title=BarSeries However I faced several problems:

First of all he can't recognize namespace oxy, as a result he can't find any required function, such as CategoryAxis and BarSeries, despite the fact, that I have added all neccessary libraries.

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="OxyPlot.Core" version="2013.2.138.1" targetFramework="net451" />
  <package id="OxyPlot.Wpf" version="2013.2.138.1" targetFramework="net451" />
</packages>

Main.Window.xaml.cs

using OxyPlot;

namespace OxyPlotDemo
{

    public partial class MainWindow : Window
    {
        public MainWindow()
        {

            InitializeComponent();
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var tmp = new PlotModel();
        tmp.Axes.Add(new CategoryAxis { ItemsSource = items, LabelField = "Label" }); // dont know wher
        tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });
        tmp.Series.Add(new BarSeries { Title = "2009", ItemsSource = items, 
                                      ValueField = "Value1" });
    }
}
}

MainWindow.xml Just added button

<Window x:Class="OxyPlotDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Button Content="Button" HorizontalAlignment="Left" Margin="432,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>

    </Grid>
</Window>

VS2013 says, that he don't know any CategoryAxis, items, LinearAxis, AxisPosition, BarSeries, how I can get them or what am I doing wrong? And is it possible to avoid DataBinding. Or maybe someone how create bar chart in other way?

È stato utile?

Soluzione

VS2013 says, that he don't know any CategoryAxis, items, LinearAxis, AxisPosition, BarSeries

Add those namespaces: using OxyPlot.Axes; using OxyPlot.Series;

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top