This is a migrated thread and some comments may be shown as answers.

Linear Axis values are shortened and other RadChartView problems

1 Answer 95 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Ejaz
Top achievements
Rank 1
Ejaz asked on 28 Jul 2014, 07:43 AM
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.

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 29 Jul 2014, 07:55 AM
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.
 
Tags
ChartView
Asked by
Ejaz
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or