views:

271

answers:

1

I am scanning computers and their scale can not be like 1.5,2,2.5 they should be in whole numbers like 1,2,3,4.

my current code is

ICollection<KeyValuePair<String, int>> data = new Dictionary<String, int>();
            data.Add(new KeyValuePair<string, int>(Protocol, protocolCount));

            mycolseries = new ColumnSeries
                {
                    ItemsSource = data,
                    Title = Protocol,
                    IndependentValuePath = "Key",
                    DependentValuePath = "Value",                        
                };                
            mainChart.Series.Add(mycolseries);

if i change dependent value to "key" it gives strange errors like "new should be used with the invocation or element, or has not been initialized"

A: 
public void Window1(){
       setChartSCale()
}


    private void setChartScale()
    {
     lamainChart.Interval = 1;
    lamainChart.Orientation = AxisOrientation.Y;
    lamainChart.ShowGridLines = true;
    //lamainChart.Maximum = 50;
    lamainChart.Minimum = 0;
    }

call this method recursivly private void addRecursiveLedgendAfterInit(string Protocol, int protocolCount) { ICollection> data = new Dictionary(); data.Add(new KeyValuePair(Protocol, protocolCount));

            mycolseries = new ColumnSeries
                {
                    ItemsSource = data,
                    Title = Protocol,
                    IndependentValuePath = "Key",                        
                    DependentRangeAxis =lamainChart,
                    DependentValuePath = "Value"

                };                
            mainChart.Series.Add(mycolseries); 



    }
Aizaz