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

Few Questions

1 Answer 36 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 2
Erik asked on 23 Sep 2011, 04:23 PM
Hello,

I'm new to radChart, not to Telerik...

I had a lot of issues, but could find out the most part on the site. I still have this issues:
** Please look at the attached image **

1) The StackedBar radChart does not use it's full potentionally vertical space. It is always about 50% for the largest bar. Must i set somesort of scaling or something like that ?

2) I have a sum on top of the bar. This is done by showing only the last/top stack label and hiding the rest (vb) I successfully changed it's font size (xaml resource), but want to change its back/fore ground also. (its now pink, like the last color of the last stack) but that has no effect. Please look at the XAML and code behind below. 

<telerik:RadChart
    x:Name="rcAgeing"
    Margin="0,14,1,14"
    HorizontalAlignment="Left"
    HorizontalContentAlignment="Left"
    VerticalAlignment="Top"
    VerticalContentAlignment="Top"
    Width="170"
    BorderBrush="Black"
    Background="Black" 
    Height="121">
    <telerik:RadChart.Resources>
        <Style x:Key="TopItemLabelStyle" TargetType="telerik:SeriesItemLabel">
            <Setter Property="FontSize" Value="7" />
            <Setter Property="Background" Value="Black" />
            <Setter Property="Foreground" Value="White" />
        </Style>
    </telerik:RadChart.Resources>
    <telerik:RadChart.DefaultSeriesDefinition>
        <telerik:BarSeriesDefinition>
        </telerik:BarSeriesDefinition>
    </telerik:RadChart.DefaultSeriesDefinition>
    <telerik:RadChart.AnimationSettings>
        <telerik:AnimationSettings  />
    </telerik:RadChart.AnimationSettings>
    <telerik:RadChart.DefaultView>
        <telerik:ChartDefaultView>
            <telerik:ChartDefaultView.ChartTitle>
                <telerik:ChartTitle Visibility="Collapsed" />
            </telerik:ChartDefaultView.ChartTitle>
            <telerik:ChartDefaultView.ChartArea>
                <telerik:ChartArea Padding="5,0,6,0" IsTabStop="False" SmartLabelsEnabled="True" >
                    <telerik:ChartArea.Annotations >
                        <telerik:MarkedZone Background="Black" />
                    </telerik:ChartArea.Annotations>
                    <telerik:ChartArea.AxisX>
                        <telerik:AxisX Visibility="Collapsed" />
                    </telerik:ChartArea.AxisX>
                    <telerik:ChartArea.AxisY>
                        <telerik:AxisY Visibility="Collapsed" />
                    </telerik:ChartArea.AxisY>
                </telerik:ChartArea>
            </telerik:ChartDefaultView.ChartArea>
            <telerik:ChartDefaultView.ChartLegend>
                <telerik:ChartLegend Visibility="Collapsed" />
            </telerik:ChartDefaultView.ChartLegend>                   
        </telerik:ChartDefaultView>
    </telerik:RadChart.DefaultView>
</telerik:RadChart>

VB code:

Dim obj_Series As New SeriesMappingCollection
 
rcAgeingAnalysis.SeriesMappings.Clear()
rcAgeingAnalysis.ItemsSource = Nothing
 
For i = 0 To 4
    Dim sm1 As New SeriesMapping()
    Dim d1 As New StackedBarSeriesDefinition()
 
    d1.ShowItemToolTips = True
    d1.ItemToolTipFormat = "#Y.Volume{#.00}" 
    d1.ShowItemLabels = (i = 4)
    If i = 4 Then
        d1.SeriesItemLabelStyle = TryCast(Me.rcAgeingAnalysis.Resources("TopItemLabelStyle"), Style)
        d1.ItemLabelFormat = "#STSUM"
        d1.LabelSettings.LabelDisplayMode = LabelDisplayMode.Outside
        d1.LabelSettings.Distance = 10
        d1.LabelSettings.ShowConnectors = True
    End If
    sm1.SeriesDefinition = d1
    sm1.SeriesDefinition.Appearance.Fill = New SolidColorBrush(Utils.StringToColor(mobj_AgeingColors(i)))
    sm1.LegendLabel = String.Empty
    sm1.CollectionIndex = i
    Dim im1 As ItemMapping = New ItemMapping
    im1.DataPointMember = DataPointMember.YValue
    sm1.ItemMappings.Add(im1)
    obj_Series.Add(sm1)
Next
 
Dim retVal As New List(Of Decimal())(5)
retVal.Add(New Decimal(4) {1434, 254, 1654, 2534, 534})
retVal.Add(New Decimal(4) {2123, 265, 1483, 1476, 432})
retVal.Add(New Decimal(4) {1123, 2467, 245, 2476, 7653})
retVal.Add(New Decimal(4) {235, 285, 1112, 298, 987})
retVal.Add(New Decimal(4) {1345, 1754, 298, 1143, 1895})
 
rcAgeingAnalysis.SeriesMappings = obj_Series
rcAgeingAnalysis.ItemsSource = retVal
rcAgeingAnalysis.Rebind()

Thanks,

Erik

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 28 Sep 2011, 02:59 PM
Hi Erik,

Onto your questions:
1) You can control this by setting a manual Range for the YAxis (turn off the AutoRange property and provide your own MinValue, MaxValue and Step). On the other hand you may change the SeriesDefinition to StackBar100 . As it name says - the Bars will take 100% of the ChartArea Height.

2) As to your issue with the style, could you please send us a runnable project where this reproduces? This way we'll be able to see all your Chart settings, investigate your project locally and get back to you with our findings/suggestions.

Regards,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Erik
Top achievements
Rank 2
Answers by
Evgenia
Telerik team
Share this question
or