图形报表,HighCharts

官网:http://www.hcharts.cn/

1、实现图形报表需要几个js插件.可以去官方下载.

2、我这边还用到了Easyui。这样更美观一点,也是为了显示数据。废话不多说上代码

JS:

    <script type="text/javascript">
        $(function () {
            $("#bg").datagrid({
                data: <%=bg_DataInfo%>
                });
        });


        $(function () {
            $('#container').highcharts({
                chart: {
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false
                },
                credits: {
                    enabled: false //屏蔽版权信息
                },
                //更改HighCharts默认下载图片打印操作,更改成中文
                lang:
                {
                    downloadJPEG:'下载jpeg',
                    downloadPDF:'下载pdf',
                    downloadPNG:'下载PNG',
                    downloadSVG:'下载SVG',
                    printChart:'打印图标',
                    contextButtonTitle:'打印操作'
                },

                title: {
                    text: '购买次数报表'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: true,
                            color: '#000000',
                            connectorColor: '#000000',
                            format: '<b>{point.name}</b>: {point.percentage:.1f} %'
                        }
                    }
                },
                series: [{
                    type: 'pie',
                    name: ' ',
                    data: [
                        ['购买一次的用户', <%=YiCi%>],
                        ['购买两次的用户', <%=ErCi%>],
                        ['购买三次次的用户', <%=SanCi%>],
                        ['购买四次的用户', <%=SiCi%>],
                        ['购买五次大于的用户', <%=WuCi%>]
                    ]
                }]
            });
        });

    </script>

<div data-options="region:'north',iconCls:'icon-ok',title:'操作'" style="padding: 4px">
            <asp:TextBox CssClass="easyui-datebox" ID="Start_Time" runat="server" Width="100px"></asp:TextBox>  
            <asp:TextBox CssClass="easyui-datebox" ID="End_Time" runat="server" Width="100px"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Text="搜索" Width="65px" OnClick="btn_Search_Click" />
        </div>
        <div data-options="region:'center'" style="height:800px; padding: 5px;">
            <div class="easyui-tabs" data-options="fit:true,tabWidth:112,fit:true">
                <div title="用户" id="container">
                </div>
                <div title="数据报表">
                    <table class="easyui-datagrid"  id="bg" 
                        data-options="singleSelect:true,collapsible:true,fit:true,fitColumns:true">
                        <thead>
                            <tr>
                                <th data-options="field:'A',width:80,formatter:OpeartionFormatterFirst">购买一次的用户</th>
                                <th data-options="field:'B',width:80,formatter:OpeartionFormatterFirst1">购买二次的用户</th>
                                <th data-options="field:'C',width:80,formatter:OpeartionFormatterFirst2,align:'right'">购买三次的用户</th>
                                <th data-options="field:'D',width:80,formatter:OpeartionFormatterFirst3,align:'right'">购买四次的用户</th>
                                <th data-options="field:'E',width:80,formatter:OpeartionFormatterFirst4,align:'right'">购买大于5次的用户</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
<script>
        //增加Checkbox
        function OpeartionFormatterFirst(value, row, index,number) {
            return "<a href='aaa.aspx?number=1&type=1'>"+value+"</a>";
        }
        function OpeartionFormatterFirst1(value, row, index,number) {
            return "<a href='aaa.aspx?number=2&type=1'>"+value+"</a>";
        }
        function OpeartionFormatterFirst2(value, row, index,number) {
            return "<a href='aaa.aspx?number=3&type=1'>"+value+"</a>";
        }
        function OpeartionFormatterFirst3(value, row, index,number) {
            return "<a href='aaa.aspx?number=4&type=1'>"+value+"</a>";
        }
        function OpeartionFormatterFirst4(value, row, index,number) {
            return "<a href='aaa.aspx?number=5&type=1'>"+value+"</a>";
        }

    </script>



展示图:


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值