ItemLabel display

7 posts, 0 answers
  1. c
    c avatar
    17 posts
    Member since:
    Apr 2011

    Posted 30 May 2012 Link to this post

    Hi,

    I'm using ItemLabel,but when the ItemLabel string is very long ,it can't display completely as the image attached。I try to reduce the size of the PieChart by setting the padding property, in order to leave more space to the itemlabel ,

    but the boundary of the chartarea is reduced too.Is there any good suggestion?

    Thanks~

  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 04 Jun 2012 Link to this post

    Hi,

    By default the ChartLegend takes all the space that it needs for the LegendLabel-s, so it seams very strange that you have managed to override this behaviour.

    Can you provide some code so we can have have a look?

    Kind regards,
    Petar Kirov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. c
    c avatar
    17 posts
    Member since:
    Apr 2011

    Posted 05 Jun 2012 Link to this post

    ISeriesDefinition sd;
    InteractivitySettings inter = new InteractivitySettings()
    {
           HoverScope = InteractivityScope.Item,
           SelectionMode = ChartSelectionMode.Single,
           SelectionScope = InteractivityScope.Item
    };
    sd = new PieSeriesDefinition()
    {
          LabelSettings = new RadialLabelSettings()
          {
                 SpiderModeEnabled = true,
                 ShowConnectors = true
          }
    };
    sd.ShowItemLabels = true;
    sd.LegendDisplayMode = LegendDisplayMode.DataPointLabel;
    sd.SeriesItemLabelStyle = this.Resources["SeriesItemLabelStyle"] as Style;
    this.RadChart2.DefaultSeriesDefinition = sd;
    this.RadChart2.DefaultView.ChartLegend.Header = "";
    this.RadChart2.DefaultView.ChartArea.SmartLabelsEnabled = true;
    this.RadChart2.DefaultView.ChartArea.Extensions.Add(new CameraExtension());
    this.RadChart2.DefaultView.ChartLegendPosition = Telerik.Windows.Controls.Dock.Bottom;
    this.RadChart2.ItemsSource = Convert2ChartItemssource();
    }


    and the  SeriesItemLabelStyle :
    <Style x:Key="SeriesItemLabelStyle"
          TargetType="telerik:SeriesItemLabel">
              <Setter Property="ContentTemplate">
                  <Setter.Value>
                      <DataTemplate>
                          <TextBlock TextAlignment="Left" MaxWidth="100" TextWrapping="Wrap"
                              Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
                      </DataTemplate>
                  </Setter.Value>
              </Setter>
          </Style>

  5. c
    c avatar
    17 posts
    Member since:
    Apr 2011

    Posted 05 Jun 2012 Link to this post

    Hi,

    there is another problem.When there is only one bar in BarSeriesDefinition,how can I set the length of the bar?

    thanks!

  6. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 07 Jun 2012 Link to this post

    Hi,

    The length of the bar items in the bar-like series is proportional to the range of the series ( the difference between the highest and the lowest value). So this length will be different depending on what items a series has.
    The only way to override this is to explicitly set the RadChartX.DefaultView.ChartArea.AxisY.AutoRange property to "false" and then set the
    RadChartX.DefaultView.ChartArea.AxisY.MaxValue and MinValue to your desired values.

    If you want to adjust the Width of the bars you can refer to this help topic.

    Kind regards,
    Petar Kirov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  7. c
    c avatar
    17 posts
    Member since:
    Apr 2011

    Posted 07 Jun 2012 Link to this post

    Hi,

      Thanks very much,I  get that.and there is another question again.The default decimal places of the bar YValue is 2,For example,the true value is 0.012,but the display value on the bar label is 0.01. how can i set the decimal places?

     

  8. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 12 Jun 2012 Link to this post

    Hi,

    You can set the decimal places and other formatting-related stuff by using Format Expressions. I advice you to check this help topic. I believe that it should answer most, if not of all, of your formatting questions. 

    Kind Regards,
    Petar Kirov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
DevCraft banner