x Category not showing as required

2 posts, 0 answers
  1. Ramakrishna
    Ramakrishna avatar
    16 posts
    Member since:
    Jan 2011

    Posted 24 Feb 2012 Link to this post

    Hi,
    I attached 2 images with this post
    Currentgraph:  it is the my current rendering chart using telerik chart.
    Imagegraph: it is the expected graph

    actually right now i am getting the graph what i need but in x axis i need to show only month names like January February.
    below is the sample data  i have

    Date Month Hour Aggregate
    1/1/2010 January 0 408
    1/1/2010 January 1 405
    1/1/2010 January 2 399
    1/2/2010 February
    0
    415
    1/2/2010 February 1
    407
    1/2/2010 February 2
    407
    1/3/2010 March 0
    399
    1/3/2010 March 1
    408
    1/3/2010 March 2
    401

    i want to show Aggregate in y axis
    Month in X- axis.(month should be show like category type like all January values should be group it means for each aggregate value i dont need to show January January January January like instead of only one January is enough for all values)

    right now i did like that only but my graph look like in currentgraph.png file(problem here is in x- axis it is giving numbers why it is giving like that  i dont know because i didn't tell to that give me like that apart from that every thing is coming good)

    below i am pasting my current code feel free to change the code to meet my requirement in imagegraph.png(no need to show Hour and Date is X-axis i written because to show i dont want to group Aggregate value by month name)

    <telerik:RadChart x:Name="RCAD" PaletteBrushesUseSolidColors="True">
                        <telerik:RadChart.DefaultView>
                            <telerik:ChartDefaultView>
                                <telerik:ChartDefaultView.ChartTitle>
                                    <telerik:ChartTitle Content="Annual Demand" HorizontalAlignment="Stretch"/>
                                </telerik:ChartDefaultView.ChartTitle>
                                <telerik:ChartDefaultView.ChartArea>
                                    <telerik:ChartArea NoDataString="Loading please wait" LegendName="RCADLegend">
                                        <telerik:ChartArea.AnimationSettings>
                                            <telerik:AnimationSettings ItemAnimationDuration="00:00:03">
                                            </telerik:AnimationSettings>
                                        </telerik:ChartArea.AnimationSettings>
                                        <telerik:ChartArea.AxisX>
                                            <telerik:AxisX AutoRange="True" LayoutMode="Inside" Title="Month" LabelRotationAngle="270"></telerik:AxisX>
                                        </telerik:ChartArea.AxisX>
                                        <telerik:ChartArea.AxisY>
                                            <telerik:AxisY Title="Demand(KWH)" AutoRange="True"></telerik:AxisY>
                                        </telerik:ChartArea.AxisY>
                                    </telerik:ChartArea>
                                </telerik:ChartDefaultView.ChartArea>
                            </telerik:ChartDefaultView>
                        </telerik:RadChart.DefaultView>
                        <telerik:RadChart.SeriesMappings>
                            <telerik:SeriesMapping>
                                <telerik:SeriesMapping.SeriesDefinition>
                                    <telerik:SplineSeriesDefinition ShowItemLabels="False" ShowItemToolTips="True" ShowPointMarks="False">
                                        <telerik:SplineSeriesDefinition.Appearance>
                                            <telerik:SeriesAppearanceSettings>
                                                <telerik:SeriesAppearanceSettings.PointMark>
                                                    <telerik:PointMarkAppearanceSettings Shape="Circle">
                                                    </telerik:PointMarkAppearanceSettings>
                                                </telerik:SeriesAppearanceSettings.PointMark>
                                            </telerik:SeriesAppearanceSettings>
                                        </telerik:SplineSeriesDefinition.Appearance>
                                    </telerik:SplineSeriesDefinition>
                                </telerik:SeriesMapping.SeriesDefinition>
                                <telerik:SeriesMapping.ItemMappings>
                                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Aggregate"></telerik:ItemMapping>
                                    <telerik:ItemMapping DataPointMember="XValue" FieldName="Month1"></telerik:ItemMapping>
                                </telerik:SeriesMapping.ItemMappings>
                            </telerik:SeriesMapping>
                        </telerik:RadChart.SeriesMappings>
                    </telerik:RadChart>

    Please give me response, it is urgent requirement for my project

    Thank you in advance
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 28 Feb 2012 Link to this post

    Hi,

    1. If you want to have the axis Y title rotated you can use the AxisY.AxisStyles. But keep in mind that the axis Y title was never intended to be rotated so you might have some difficulties setting it to look as you want (if difficulties arise you can consider placing a text block manually instead). This code will get you started with the axis styles:
    <telerik:AxisY>
     <telerik:AxisY.AxisStyles>
      <telerik:AxisStyles>
       <telerik:AxisStyles.TitleStyle>
        <Style TargetType="telerik:AxisTitle" >
         <Setter Property="Height" Value="80" />
          <Setter Property="RenderTransform">
           <Setter.Value>
            <RotateTransform Angle="90" />
     
    3. Month in X- axis.
    Unfortunately there is no way to achieve what you have described and depicted in the attached images. The X axis has major and minor ticks and some of the major ticks have labels. Thus there is no way to achieve such a complex layout.

    4. In the CurrentGraph image the axis labels are clustered really close together. You can read this help topic to get some ideas how you can have less labels, so that the text in the labels is readable. You can set some TicksDistance, rotation angle and default label format to accomplish this task.

    All the best,
    Petar Marchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
Back to Top