• silverlight 图形报表开发


    前端:

    <UserControl x:Class="SLThree.CharReport"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:c="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        xmlns:f="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
        mc:Ignorable="d"
        d:DesignHeight="500" d:DesignWidth="800">
    
        <Grid x:Name="LayoutRoot" Background="White">
            <StackPanel Width="400" Height="400" Margin="0,20,400,80">
                <c:Chart x:Name="mychart" Height="312">
                    <c:ColumnSeries Title="销售额" DependentValueBinding="{Binding Amount}"
                                IndependentValueBinding="{Binding Day}">
                    </c:ColumnSeries>
                </c:Chart>
            </StackPanel>
            <StackPanel Width="400" Height="400" Margin="400,20,0,80">
                <c:Chart x:Name="mychart2" Height="312">
                    <c:PieSeries Title="销售额" DependentValueBinding="{Binding Amount}" IndependentValueBinding="{Binding Day}"></c:PieSeries>
                </c:Chart>
            </StackPanel>
        </Grid>

    后台:

     public CharReport()
            {
                InitializeComponent();
                MyWebService.WebService1SoapClient client = new MyWebService.WebService1SoapClient();
                client.GetAllSalesCompleted += new EventHandler<MyWebService.GetAllSalesCompletedEventArgs>(client_GetAllSales);
                client.GetAllSalesAsync();
            }
    
            void client_GetAllSales(object sender, MyWebService.GetAllSalesCompletedEventArgs e)
            {
                if (e.Error != null)
                {
                    HtmlPage.Window.Alert(e.Error.Message);
                    return;
                }
                ((ColumnSeries)(this.mychart.Series[0])).ItemsSource = e.Result;
                ((PieSeries)(this.mychart2.Series[0])).ItemsSource = e.Result;
            }

     第二种:

    前台:
      <c:Chart x:Name="mychart" Height="312">
                <c:ColumnSeries Title="上周销售额" DependentValueBinding="{Binding Amount}"
                                IndependentValueBinding="{Binding Day}">
                </c:ColumnSeries>
                <c:ColumnSeries Title="本周销售额" DependentValueBinding="{Binding Amount}"
                                IndependentValueBinding="{Binding Day}">
                </c:ColumnSeries>
            </c:Chart>

    后台:

      ((ColumnSeries)(this.mychart.Series[0])).ItemsSource = e.Result[0];
                ((ColumnSeries)(this.mychart.Series[1])).ItemsSource = e.Result[1];
  • 相关阅读:
    测试人员在软件开发过程中的任务是什么?
    python关于文件操作
    字符编码
    内置方法
    数据类型的基本使用
    Python的流程控制
    Python与用户相交互
    编程语言的发展史
    计算机的五大组成
    可迭代对象 迭代器对象 生成器对象
  • 原文地址:https://www.cnblogs.com/xinyus/p/3174701.html
Copyright © 2020-2023  润新知