如何在System.Windows.Controls.DataVisualization.Toolkit中实现DateTimeAxis控件模板

时间:2017-04-18 11:56:11

标签: wpf charts

我想覆盖默认模板,但我无法实现它。

我试过了:

def wifiscan():
    ssid = []
    scanoutput = check_output(["iwlist", "wlan0", "scan"])
    curtime = time.strftime("%I:%M:%S")
    ssid.append(curtime)

    for line in scanoutput.split():
      line=str(line)
      if line.startswith("Quality"):
        line=line[8:-25]
      if(line>30 and line.startswith("ESSID")
        line=line[7:-1]
        ssid.append(line)
    with open('/home/pi/Desktop/Project/Results/'+'test.csv','a') as csvfile:
        csvwriter = csv.writer(csvfile,delimiter=',')
        csvwriter.writerow(ssid)
    print ssid

但我在视觉树上得到了这个:

charting toolkit

如何为<charting:Chart Title="{Binding Title}" Name="chChart" LegendStyle="{StaticResource LegendStyle1}"> <charting:Chart.Axes> <charting:DateTimeAxis x:Name="Abcisa" Orientation="X" ShowGridLines="True" Title="{Binding Abscissa}"> <charting:DateTimeAxis.Template> <ControlTemplate TargetType="{x:Type charting:DateTimeAxis}"> <Grid x:Name="AxisGrid"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <!--generate content for x axis--> <datavis:Title x:Name="AxisTitle" Grid.Row="1" /> </Grid> </ControlTemplate> </charting:DateTimeAxis.Template> </charting:Chart> 控件创建模板?

1 个答案:

答案 0 :(得分:1)

您应该将Style的{​​{1}}属性设置为Title的{​​{1}}。这是默认模板的样子:

TitleStyle

但您还需要在图表中添加一些数据系列以显示轴。有关此内容和示例的详细信息,请参阅以下文章:BusyBox based Linux systems