简体   繁体   中英

Wrap legend text in Visiblox chart

When I explicitly set the width of the legend in a Visiblox chart I find that legend item text gets cut off instead of wrapping. For example,

<Style x:Key="LegendStyle" TargetType="{x:Type charts:Legend}">
    <Setter Property="Width" Value="200" />
</Style>

<charts:Chart Name="chart" LegendStyle="{StaticResource LegendStyle}" />

I know I can use the LegendTemplate property of the Chart control to provide a ControlTemplate for the Legend class. However, I am not sure how I would modify this to produce text wrapping in the child LegendItem controls. I am also not sure how I can modify the template used to draw the LegendItem controls to produce text wrapping. Is there a way to do this?

It might be easier to provide a LegendItemTemplate or a LegendItemStyle. These are dependency properties on the series type. You can get more information in the documentation under the "Styling and templating" section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM