Is Rad CartesianChart has any width limit?

13 posts, 0 answers
  1. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 06 Dec 2012 Link to this post

    i use  Rad CartesianChart for date present. 

    and i am sure that data was get correctly.

    here is the data object.

     public class DataUnit : Object
        {
            private DateTime _timeStamp = DateTime.Now;
            [DataMember]
            public DateTime TimeStamp
            {
                get { return this._timeStamp; }
                set { this._timeStamp = value; }
            }
     
            private string _name = string.Empty;
            [DataMember]
            public string Name
            {
                get { return this._name; }
                set { this._name = value; }
            }
     
            private double _value = 0.0;
            [DataMember]
            public double Value
            {
                get { return this._value; }
                set { this._value = value; }
            }
     
            public DataUnit()
            {
     
            }
            public DataUnit(DateTime stamp, string name, double value)
            {
                this._timeStamp = stamp;
                this._name = name;
                this._value = value;
            }
        }

    for example
    i have 5 list for 500 records.   each list have  a barseries.

    axis = new DateTimeCategoricalAxis()
                        {
                            LabelFitMode = AxisLabelFitMode.MultiLine,
                            LabelTemplate = DefaultLabelTemplate
                        };

    this.BarChart.HorizontalAxis = axis;
     
                this.BarChart.Series.Clear();
     
                foreach (ChartData cd in ViewModel.DegreeData)
                {
                    BarSeries cs = new BarSeries();
                    cs.ItemsSource = cd.DataList;
                    cs.CategoryBinding = new PropertyNameDataPointBinding("TimeStamp");
                    cs.ValueBinding = new PropertyNameDataPointBinding("Value");
                    cs.PointTemplateSelector = DefaultSelector;
                    this.BarChart.Series.Add(cs);
                }


    the problem is :

    there will be 5 series. so, each bar with a minwidth 20. with 500 data items, the chart width  would be 20*5*500 = 50000.  
    when i want to set the width of chart like over 40960. i get incorrect render. the two side will be blank white. in another word, noting. 

    but the center area is correct. 

    see the pictures. 


    if i want to see the data from 2012-12 -2014-12. it just show a part. like from 2013. 02 - 2014.07.

     
    Is Rad CartesianChart has any width limit? 

    if not ,how can i solve this problem.

  2. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 06 Dec 2012 Link to this post

    i try many values. from 50000 drop down to 32426.

    32426 is the maxmun value that chart render crrocect.

    can some one figure out which problem is ?
  3. DevCraft banner
  4. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 11 Dec 2012 Link to this post

    Hi,

    The cause of the problem is not from the RadCartesianChart, but from the Silverlight framework itself - FrameworkElements wider than 32K pixels are not rendered correctly. The bug can be reproduced in a simple example like this:
    <Grid x:Name="LayoutRoot" Background="White">
        <Line X1="0" X2="60000" Y1="0" Y2="100" Stroke="Black" Margin="10"/>
    </Grid>

    You can read more on the matter in the Silverlight forums on this link.
     
    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Mateusz
    Mateusz avatar
    6 posts
    Member since:
    Jun 2012

    Posted 17 Dec 2012 Link to this post

    Hi,
    I have similiar problem with BarSeries. I'm not sure if exact the same.
    In my project I use RadCartesianChart nested in RadPane. When size of RadCartesianChart is ~900x500px, maximum number of points that could be shown is about 800-900.
    When I set size of RadPane with ChartView to full screen (1920x1200px) max amount of points is ~1700-1800.
    On the same RadCartesianView I show also LineSeries, and the most weird thing is that  there's no limit for numer of points for this kind series (problem doesn't occur for much bigger data series).
    Is it connected with size of single point?
  6. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 18 Dec 2012 Link to this post

    thank you very much. i set the maxwidth to 32k, it works well.
  7. Mateusz
    Mateusz avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Dec 2012 Link to this post

    Ye - maxwidth of serie? or the chartView?
  8. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 18 Dec 2012 Link to this post

    try to set the with more bigger with chartview.

    and you can define the data point template.

  9. Mateusz
    Mateusz avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Dec 2012 Link to this post

    could You share some part of code showing how You made this?
  10. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 18 Dec 2012 Link to this post

    this can be use for you bar data point.
    <
    DataTemplate x:Key="blueBar"> <Rectangle Fill="#3399FF" MinWidth ="{Binding MinBarWidth, Mode=TwoWay,Source={StaticResource AppUtils} }" MaxWidth="{Binding DefaultBarWidth, Mode=TwoWay,Source={StaticResource AppUtils} }"/>
    </DataTemplate>

    <telerik:RadCartesianChart x:Name="BarChart"  Grid.Row="1"   Width="{Binding ChartWidth,Mode=TwoWay}" MinWidth="500" >
     
    							<telerik:BarSeries></telerik:BarSeries>
    							<telerik:RadCartesianChart.HorizontalAxis>
    								<telerik:DateTimeCategoricalAxis/>
    							</telerik:RadCartesianChart.HorizontalAxis>
    							<telerik:RadCartesianChart.VerticalAxis>
    								<telerik:LinearAxis Title="Tid (sekunder)"/>
    							</telerik:RadCartesianChart.VerticalAxis>
     
    							<telerik:RadCartesianChart.Grid>
    								<telerik:CartesianChartGrid MajorLinesVisibility="Y" />
    							</telerik:RadCartesianChart.Grid>
    
    ///
    if (this.ViewModel.ChartWidth >= AppUtils.MaxControlWidth)
                {
                    axis.LabelFitMode = AxisLabelFitMode.Rotate;
                }
     
                this.BarChart.HorizontalAxis = axis;
     
                this.BarChart.Series.Clear();
     
                foreach (ChartData cd in ViewModel.DegreeData)
                {
                    BarSeries cs = new BarSeries();
                    cs.ItemsSource = cd.DataList;
                    cs.CategoryBinding = new PropertyNameDataPointBinding("TimeStamp");
                    cs.ValueBinding = new PropertyNameDataPointBinding("Value");
    // here you can set the template use pointtemplateselector.                
                    cs.PointTemplateSelector = DefaultSelector;                 this.BarChart.Series.Add(cs);             }


    i think your problem is the problem with the series. if you set the minwidth, it will show correctly.
    good luck.
  11. Mateusz
    Mateusz avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Dec 2012 Link to this post

    As You can see the point template that is used in my project look similiar to your:
    <DataTemplate x:Key="barTemplate">
        <Rectangle Fill="{Binding Presenter.Stroke}" Opacity=".8" MinWidth="1" />
    </DataTemplate>
    Only difference is that in my ViewModel when adding bar series to the chart, I set PointTemplate nor PointTemplateSelector property of BarSeries:
    barSeries.PointTemplate = App.Current.Resources["barTemplate"] as DataTemplate;


    You said:
    thank you very much. i set the maxwidth to 32k, it works well.
    maxWidth of what? chart? serie?
  12. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 18 Dec 2012 Link to this post

    barSeries is used for show different datasource.  like we show  incomes of each employees.

    if you have 5 people, then you have 5 barseries. 

    if you have one people, but just show 5 months incomes. then use one  barseries. 
    and the datapoint will created automatically.

    just define the data as the telerik's examples. 
  13. Mateusz
    Mateusz avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Dec 2012 Link to this post

    I pretty well understand difference between series offered by RadCartesianChart, also know how and when use them.
    I think that You didn't understand what I wrote.
    The problem isn't in data provided to the serie, and the way I add the serie to the chart (single serie binded to the data collection).

    Once again, You wrote:

    thank you very much. i set the maxwidth to 32k, it works well.
    what does it mean? which maxWidth? Can U provide the sample showing this?

    Any idea? ;)
  14. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 18 Dec 2012 Link to this post

    i guess you want to set the width of barseries,

    i am not sure that if it works so. you set a Variable bind to the width.  two way.

    and make a textbox bind to the width also.

    then you can try from 32000 to 0, to see if some value show correct for your chart.
Back to Top
DevCraft banner