Linechart - how to show X axis?

Jan 12, 2016 at 12:23 AM
Edited Jan 12, 2016 at 12:34 AM
X-Axis does not show and for some reason, it creates a legend entry for every data point in my series rather that a single legend entry with the series name.

Am I doing something wrong here?

Image

XAML:
<GAChart:GAMultipleTypeSeriesChart Style="{StaticResource MinimalChartStyle}"
            DataContext="{Binding ''}"                      
            ChartTitle="GA Multiple Series Type Chart" 
            ChartSubTitle="Series overlap - column, scatter, line, custom"                       
            SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" 
            Height="Auto" Width="Auto">
            <GAChart:GAMultipleTypeSeriesChart.Series>
                <GAChart:ChartSeries
                    SeriesTitle="Freq Response"
                    DisplayMember="Freq"
                    ValueMember="Value"
                    DataPointType="{x:Type GAChart:GALinePiece}"
                    ItemsSource="{Binding freqdata1.Items}"                    
                />
            </GAChart:GAMultipleTypeSeriesChart.Series>
        </GAChart:GAMultipleTypeSeriesChart>
Data Model
    public class FreqDataPoint : BaseModel
    {
        private double _Freq = 0.0d;
        private double _Value = 0.0d;

        public double Freq
        {
            get { return _Freq; }
            set 
            { 
                _Freq = value;
                RaisePropertyChanged("Freq");
            }
        }

        public double Value
        {
            get { return _Value; }
            set
            {
                _Value = value;
                RaisePropertyChanged("Value");
            }
        }

        public FreqDataPoint(double freq, double value)
        {
            this.Freq = freq;
            this.Value = value;            
        }
    }

    public class FreqData : BaseModel
    {
        private string _seriesDisplayName;
        public string seriesDisplayName
        {
            get
            {
                return _seriesDisplayName;
            }
            set
            {
                if (_seriesDisplayName != value)
                {
                    _seriesDisplayName = value;
                    RaisePropertyChanged("seriesDisplayName");
                }
            }
        }

        public ObservableCollection<FreqDataPoint> Items { get; set; }

        public FreqData()
        {
            Items = new ObservableCollection<FreqDataPoint>();
        }
    }
ViewModel:
    public class MainViewModel : BaseModel
    {
        private FreqData _freqdata1;
        public FreqData freqdata1
        {
            get
            {
                return _freqdata1;
            }
            set
            {
                if (_freqdata1 != value)
                {
                    _freqdata1 = value;
                    RaisePropertyChanged("freqdata1");
                }

            }
        }

        private object selectedItem = null;
        public object SelectedItem
        {
            get
            {
                return selectedItem;
            }
            set
            {
                // selected item has changed
                selectedItem = value;
                RaisePropertyChanged("SelectedItem");
            }
        }

        public MainViewModel()
        {

            freqdata1 = new FreqData();
            freqdata1.seriesDisplayName = "Series 1";
            freqdata1.Items.Add(new FreqDataPoint(13255, 35));
            freqdata1.Items.Add(new FreqDataPoint(13260, 35));
            freqdata1.Items.Add(new FreqDataPoint(13265, 43));
            freqdata1.Items.Add(new FreqDataPoint(13270, 49));
            freqdata1.Items.Add(new FreqDataPoint(13275, 36));
            freqdata1.Items.Add(new FreqDataPoint(13280, 37));
            freqdata1.Items.Add(new FreqDataPoint(13285, 35));
            freqdata1.Items.Add(new FreqDataPoint(13290, 43));
            freqdata1.Items.Add(new FreqDataPoint(13295, 26));
            freqdata1.Items.Add(new FreqDataPoint(13300, 25));
            freqdata1.Items.Add(new FreqDataPoint(13305, 34));
            freqdata1.Items.Add(new FreqDataPoint(13310, 47));
            freqdata1.Items.Add(new FreqDataPoint(13315, 25));
            freqdata1.Items.Add(new FreqDataPoint(13320, 50));
            freqdata1.Items.Add(new FreqDataPoint(13325, 22));
            freqdata1.Items.Add(new FreqDataPoint(13330, 47));
            freqdata1.Items.Add(new FreqDataPoint(13335, 31));
            freqdata1.Items.Add(new FreqDataPoint(13340, 23));
            freqdata1.Items.Add(new FreqDataPoint(13345, 30));
            freqdata1.Items.Add(new FreqDataPoint(13350, 35));
            freqdata1.Items.Add(new FreqDataPoint(13355, 41));
            freqdata1.Items.Add(new FreqDataPoint(13360, 48));
            freqdata1.Items.Add(new FreqDataPoint(13365, 40));
            freqdata1.Items.Add(new FreqDataPoint(13370, 41));
            freqdata1.Items.Add(new FreqDataPoint(13375, 41));
            freqdata1.Items.Add(new FreqDataPoint(13380, 49));
            freqdata1.Items.Add(new FreqDataPoint(13385, 47));
            freqdata1.Items.Add(new FreqDataPoint(13390, 45));
            freqdata1.Items.Add(new FreqDataPoint(13395, 26));
            freqdata1.Items.Add(new FreqDataPoint(13400, 50));
            
        }        
   
    }
Jan 27, 2016 at 3:48 PM
Edited Jan 27, 2016 at 3:58 PM
I am having a very similar problem. In my case, it creates a legend entry for every data point in my series rather that a single legend entry with the series name. However, I am also not getting a plot in the chart either. I notice at the bottom I am getting "Object reference not set to instance of an object". My binding is from a data source which contains a List of items. I am binding this list (i.e. result) to the DataContext.
<GAChart:GAMultipleTypeSeriesChart Name="chart1"  ChartTitle="GA Multiple Series Type Chart" ChartSubTitle="Single Column Series">
            <GAChart:GAMultipleTypeSeriesChart.Series >
                <GAChart:ChartSeries 
                          SeriesTitle="Testing" 
                          DisplayMember="WeekId" 
                          ValueMember="Hours" 
                          ItemsSource="{Binding}" 
                          DataPointType="{x:Type GAChart:GALinePiece}"  />
            </GAChart:GAMultipleTypeSeriesChart.Series>
        </GAChart:GAMultipleTypeSeriesChart>
chart1.DataContext = result
I have tried the data with the ClusteredBarChart and the data displays properly.
Mar 23, 2016 at 8:21 PM
From my understanding of MultipleSeriesChart, it is used specifically to plot more than one line.
When multiple lines are plotted, the names of each line clearly show up.
Plotting a single line has issues.

There is a reason the library is still in beta.
Coordinator
May 31, 2016 at 8:10 PM
Yes, you are correct - the Multiple Series is for multiple series only. Otherwise use the standard charts which work well. And if you look in the chart above the x-axis is visible - its the dark horizontal line at the bottom.
Jun 2, 2016 at 8:08 PM
So you cannot do a single series line chart?
Coordinator
Jun 2, 2016 at 9:17 PM
It's meant to work with 1 or more lines, or multiple series (ie columns and lines - not bars at this stage). It is very much beta - I developed it for a specific purpose and haven't had much time since to continue. If it does only work with more than one line at the moment, or one line and columns, a work around would be to create another series and have the style to be transparent.
Coordinator
Jun 2, 2016 at 9:24 PM
Have you tried items source binding to the items like {binding:my source.items} - I expect that's where the null object is. Also if it currents only works properly with 1 line (ie gives too many legends) try adding a second series with transparent styles. I'll try to have a look at this issue soon.
Jun 8, 2016 at 1:58 PM
Try to add IsRowColumnSwitched="True" in
<GAChart:GAMultipleTypeSeriesChart Style="{StaticResource MinimalChartStyle}"
            DataContext="{Binding ''}"                      
            ChartTitle="GA Multiple Series Type Chart" 
            ChartSubTitle="Series overlap - column, scatter, line, custom"                       
            SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" 
            Height="Auto" Width="Auto">
I don't know why, but this worked for me with the legend entries problem.