Echats for .NET

前段时间闲得无聊,作死把百度Echats的API用C#描述了一遍,进行了简单的封装。

结构是这样的:



折线图的效果是这样的:



用法是这样的:

var options = new Option
            {
                title = new Title { text = "2015销量图" },
                legend = new Legend
                {
                    padding = 5,
                    itemGap = 10,
                    data = new List<object> { "ios", "android" }
                },
                toolbox = new Toolbox(),
                tooltip = new Tooltip
                {
                    trigger = Enum.GetName(typeof(Trigger), Trigger.item)
                },
                xAxis = new List<XAxis> {
                    new XAxis
                    {
                        type = Enum.GetName(typeof(AxisType), AxisType.category),
                        data = new List<object>
                                {
                                    "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
                                }
                    }
                },
                series = new List<Series>
                {
                    new Line
                    {
                        name = "ios",
                        data = new List<object>
                        {
                            112, 23, 45, 56, 233, 343, 454, 89, 343, 123, 45, 123
                        }
                    },
                    new Line
                    {
                        name = "android",
                        data = new List<object>
                        {
                            45, 123, 145, 526, 233, 343, 44, 829, 33, 123, 45, 13
                        }
                    }
                },
                yAxis = new List<YAxis>
                {
                    new YAxis
                    {
                        type = Enum.GetName(typeof(AxisType), AxisType.value),
                        axisLabel = new AxisLabel
                        {
                            formatter = "{value} 台"
                        },
                        name = "测试",
                        min = 0,  //custom
                        max = 829 //custom
                    }
                },
                calculable = true
            };

个人觉得用起来还是蛮方便的,但是遇到的问题是在处理一些比较复杂的问题时怎么在C#中定义JavaScript代码的问题。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值