回复 1楼goodzhu110的帖子
主要思路是通过 RotateTransform3D 来进行调整,请参考以下实现代码:
XAML代码:
- <Window x:Class="_9381_3DChart.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="MainWindow" Height="350" Width="525" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
- <Grid>
- <Grid.Resources>
- <c1:DataPointConverter x:Key="fc" />
- <DataTemplate x:Key="lbl">
- <Grid>
- <Path Data="M0.5,0.5 L23,0.5 23,23 11.61165,29.286408 0.5,23 z" Stretch="Fill" Fill="#FFF1F1F1" Stroke="DarkGray" StrokeThickness="1"/>
- <TextBlock FontSize="10" Margin="5 5 5 15" Foreground="DarkRed" Text="{Binding ConverterParameter=系列: \{#SeriesLabel\}\{#NewLine\}数据点: \{#PointIndex\}\{#NewLine\}数值: \{#Value\}, Converter={StaticResource fc}}" />
- </Grid>
- </DataTemplate>
- </Grid.Resources>
- <Grid.RowDefinitions>
- <RowDefinition Height="60"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <c1:C1Chart Grid.Row="1" x:Name="c1chart" ChartType="Pie">
- <c1:C1Chart.Data>
- <c1:ChartData>
- <c1:DataSeries Label="s1" Values="3 5 7 4" PointLabelTemplate="{StaticResource lbl}"/>
- </c1:ChartData>
- </c1:C1Chart.Data>
- <c1:C1ChartLegend x:Name="legend" />
- </c1:C1Chart>
- </Grid>
- </Window>
复制代码
后台C#代码:
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- c1chart.ChartType = C1.WPF.C1Chart.ChartType.Pie3DExploded;
- c1chart.View.Camera.Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(120, 90, 30), 60));
- }
- }
复制代码 |