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

Is Rad CartesianChart has any width limit?

12 Answers 152 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Ye
Top achievements
Rank 1
Ye asked on 06 Dec 2012, 03:32 PM
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.

12 Answers, 1 is accepted

Sort by
0
Ye
Top achievements
Rank 1
answered on 06 Dec 2012, 03:49 PM
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 ?
0
Petar Kirov
Telerik team
answered on 11 Dec 2012, 04:06 PM
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.

0
Mateusz
Top achievements
Rank 2
answered on 17 Dec 2012, 03:36 PM
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?
0
Ye
Top achievements
Rank 1
answered on 18 Dec 2012, 12:21 PM
thank you very much. i set the maxwidth to 32k, it works well.
0
Mateusz
Top achievements
Rank 2
answered on 18 Dec 2012, 12:40 PM
Ye - maxwidth of serie? or the chartView?
0
Ye
Top achievements
Rank 1
answered on 18 Dec 2012, 01:12 PM
try to set the with more bigger with chartview.

and you can define the data point template.

0
Mateusz
Top achievements
Rank 2
answered on 18 Dec 2012, 01:18 PM
could You share some part of code showing how You made this?
0
Ye
Top achievements
Rank 1
answered on 18 Dec 2012, 01:21 PM
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.
0
Mateusz
Top achievements
Rank 2
answered on 18 Dec 2012, 01:43 PM
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?
0
Ye
Top achievements
Rank 1
answered on 18 Dec 2012, 02:18 PM
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. 
0
Mateusz
Top achievements
Rank 2
answered on 18 Dec 2012, 02:35 PM
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? ;)
0
Ye
Top achievements
Rank 1
answered on 18 Dec 2012, 02:53 PM
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.
Tags
ChartView
Asked by
Ye
Top achievements
Rank 1
Answers by
Ye
Top achievements
Rank 1
Petar Kirov
Telerik team
Mateusz
Top achievements
Rank 2
Share this question
or