1. Citation: WPFToolkit.dll, System.Windows.Controls.DataVisualization.Toolkit.dll
2. The page code reference is as follows:
<usercontrol x:class="gdnxfd. Alert.IFIXControls.StationPieChart"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"xmlns:charting="clr-namespace:system.windows.controls.datavisualization.charting;assembly= System.Windows.Controls.DataVisualization.Toolkit"Xmlns:datavis="clr-namespace:system.windows.controls.datavisualization;assembly= System.Windows.Controls.DataVisualization.Toolkit"xmlns:chartingprimitives="clr-namespace:system.windows.controls.datavisualization.charting.primitives;assembly= System.Windows.Controls.DataVisualization.Toolkit"Height=" $"> <border borderthickness="0,0,0,1"Borderbrush="#FFFFFFFF"padding="10,0,10,10"> <StackPanel> <charting:Chart> <charting:Chart.Template> <controltemplate targettype="{x:type Charting:chart}"> <border background="{TemplateBinding Background}"BorderBrush="{TemplateBinding BorderBrush}"borderthickness="{TemplateBinding BorderThickness}"Padding="{TemplateBinding Padding}"> <Grid> <Grid.RowDefinitions> <rowdefinition height="Auto"/> <rowdefinition height="*"/> </Grid.RowDefinitions> <grid.columndefinition S> <columndefinition width="*"/> <columndefinition width=" -"/> </Grid.ColumnDefinitions> <datavis:title Cont Ent="{TemplateBinding Title}"Style="{TemplateBinding TitleStyle}"/> <chartingprimitives:edgepanel name="ChartArea"height=" the"Style="{TemplateBinding Chartareastyle}"Grid.column="0"margin="5 5 0 5"> <grid panel.zindex="-1"style="{TemplateBinding Plotareastyle}"/> <border panel.zindex="Ten"Borderbrush="#FF919191"borderthickness="1"/> </chartingprimitives:EdgePanel> <datavis:lege nd x:name="Legend"height=" the"Grid.column="1"title="{TemplateBinding Legendtitle}"Style="{TemplateBinding Legendstyle}"VerticalAlignment="Top"Horizontalalignment=" Left"Margin="0 5 5 5"/> </Grid> </Border> </controltempl ate> </charting:Chart.Template> <charting:pieseries name="Piechart"Dependentvaluepath=" Total"Independentvaluepath="ObjectName"Background="Navy"isselectionenabled="True"> </charting:PieSeries> </charting:Chart> </StackPanel> </bord Er></usercontrol>
3. Background Code Reference:
ilist<alertsnap> LST =ClientCache.Instance.AlertSnaps; if(LST! =NULL) { varQ = fromPinchLST Group p by P.stationname to GSelect NewRankingmodel {ObjectName=Getsimplifystationname (G.key), total=g.count ()}; varx = q.orderbydescending (a = a.total). Take (9). ToArray (); This. Piechart.itemssource =x; }
WPF ToolKit Chart Custom styles