Search code examples
c#wpfexcelchartsscale

WPF toolkit Is it possible to scale Chart like Excel


I am developing a plot/chart/graph. I want o scale the Y axis on Log of base 10 - so I want values 0, 10, 100, 1000, 10000, 100000 on Y axis. I am able to get the scale also, but want the values in same distances. Attached snap shots of what I get and what I want :

Results of what I get from my code : This is what I GET

Results I am looking for : This is a plot generated from Excel. In my app, I want this results i.e. equal distance between numbers.

Code that I use to scale my Y axis :

public class LogConverter : IValueConverter
{

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        double x = double.Parse(value.ToString());
        int y = (int)x;
        switch (y)
        {
            case 0:
            case 10:
            case 100:
            case 1000:
            case 10000:
            case 100000: 
            case 1000000:
            case 10000000:
                Console.WriteLine("Log = " + value);
                return y.ToString();
            default:
                return null;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

I set Min =0 & Max (dynamic) of Y Axis and its interval is set to 10. Any idea how do I achieve this goal ? Is it possible in WPF ? Any help is highly appreciated.


Solution

  • I used OxyPlot open source to achieve my goal