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

ItemLabel display

6 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
c
Top achievements
Rank 1
c asked on 31 May 2012, 02:41 AM

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~

6 Answers, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 04 Jun 2012, 08:25 AM
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 >>
0
c
Top achievements
Rank 1
answered on 05 Jun 2012, 09:32 AM
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>

0
c
Top achievements
Rank 1
answered on 05 Jun 2012, 09:35 AM

Hi,

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

thanks!

0
Petar Kirov
Telerik team
answered on 07 Jun 2012, 07:38 AM
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 >>
0
c
Top achievements
Rank 1
answered on 08 Jun 2012, 01:16 AM

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?

 

0
Petar Kirov
Telerik team
answered on 12 Jun 2012, 08:03 AM
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 >>
Tags
Chart
Asked by
c
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
c
Top achievements
Rank 1
Share this question
or