Linear Axis values are shortened and other RadChartView problems

2 posts, 0 answers
  1. Ejaz
    Ejaz avatar
    9 posts
    Member since:
    May 2014

    Posted 28 Jul 2014 Link to this post

    I'm using the rad cartesian chart control to display multiple lineseries. This is working fine. The problem is for some charts the y-axis value is very large eg: 2500000. These values are shortened to 25E+06. How can I display the entire value?
    The other problem is I'm creating a datatemplate for Labels, but multiple labels are displayed for a single datapoint. The code i'm using is -

                        TextBlock t = new TextBlock();
                        t.Text = val.ToString();
                        t.Foreground = Brushes.White;
                        t.Background = brush;

                        DataTemplate d = new DataTemplate();
                        d.DataType = typeof(TextBlock);
                        FrameworkElementFactory spf = new FrameworkElementFactory(typeof(TextBlock));
                        spf.SetValue(TextBlock.TextProperty, Convert.ToInt32(val).ToString());
                        spf.SetValue(TextBlock.ForegroundProperty, brush);
                        d.VisualTree = spf;
                        ChartSeriesLabelDefinition cld = new ChartSeriesLabelDefinition();
                        cld.Template = d;
                        lineseries.LabelDefinitions.Add(cld);

    I'm not doing this in xaml because the number of lineseries is obtained dynamically. I've also attached a snapshot.
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 29 Jul 2014 Link to this post

    Hello Ejaz,

    1. The LinearAxis has a LabelFormat property. By default, the chart calculates the labels with a G7 label format and this is why you get the 25E+06 formatting. You can set the LabelFormat to a format that fits your requirements, such as G20.

    2. It seems that you are creating several label definitions. The series will produce a label for each definition you have. So if you add 10 definitions, and if you have 5 data points - then each five data points will have 10 labels to it, hence 50 labels in total. So make sure you only add one definition per series, in order to get one label per point.

    Even though you are currently doing some things in code behind - I think you should try using the SeriesProvider, which was built with the purpose of creating dynamical number of series. References here
    QSF example which uses the SeriesProvider
    SeriesProvider SDK sample

    Let us know how it goes.

    Regards,
    Petar Marchev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top