Charting - How to avoid multiple axis names?

Aug 14, 2010 at 12:34 AM

the below code which programmatically adds line series to the chart, seems to get multiple Yaxis names being put on the graph (even though the title for each is the same).  

Is there a way to avoid this beyond programmatically making sure that the first series is the only one that sets the Y axis name?

 

            // Loop through new figures for each Process
            foreach (var kvp in returnValues)
            {
                // Create Graph Series if this is the first occurence for it
                if (!_graphData.ContainsKey(kvp.Key))
                {
                    // New Bindable Data Series
                    var newSeriesCollection = new ObservableCollection<RtData>();
                    _graphData.Add(kvp.Key, newSeriesCollection);

                    // New Assoicated Graph Series
                    var lineSeries = new LineSeries();
                    lineSeries.ItemsSource = newSeriesCollection;
                    lineSeries.IndependentValuePath = "Second";
                    lineSeries.DependentValuePath = "Kb";
                    lineSeries.Title = kvp.Key;

                    // Set Y Axis Title
                    LinearAxis linearAxis = new LinearAxis();
                    linearAxis.Orientation = AxisOrientation.Y;
                    linearAxis.Title = "KBytes";
                    lineSeries.DependentRangeAxis = linearAxis;


                    // Add the Series to the UI Chart
                    RealTimeChart2.Series.Add(lineSeries);

                }

                // Add latest data to the series in question
                var seriesData = _graphData[kvp.Key];
                var newDataPoint = new RtData() {Second = _secondCount, Kb = (int) kvp.Value};
                seriesData.Add(newDataPoint);
            }