示例#1
0
        static void _Main()
        {
            var ent = new mdl.chartpie <mdl.point>()
            {
                datasets = new List <mdl.dataset <mdl.point> >()
                {
                    new mdl.dataset <mdl.point>()
                    {
                        backgroundColor = new string[] { "red", "green" },
                        data            = new mdl.point[]
                        {
                            new mdl.point()
                            {
                                x = .1f, y = .2f
                            },
                            new mdl.point()
                            {
                                x = .3f, y = .5f
                            }
                        }
                    },
                    new mdl.dataset <mdl.point>()
                    {
                        backgroundColor = new string[] { "blue", "dark" },
                        data            = new mdl.point[]
                        {
                            new mdl.point()
                            {
                                x = .123f, y = .99f
                            },
                            new mdl.point()
                            {
                                x = .7f, y = .17f
                            }
                        }
                    }
                },
                labels = new string[] { "mingyuan", "pactera" }
            };

            Stopwatch sw = new Stopwatch();

            sw.Start();
            var val = JSer.ComplexObjToString(ent);

            Console.WriteLine(val);
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
        }
示例#2
0
文件: pie.ashx.cs 项目: ghconn/mich
        public void ProcessRequest(HttpContext context)
        {
            var _pie    = new mdl.chartpie <int>();
            var dataset = new mdl.dataset <int>();

            dataset.data            = new int[] { 60, 50, 20, 32, 99, 12 };
            dataset.backgroundColor = new string[] { "#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#4D5360", "#02B300" };
            var dataset2 = new mdl.dataset <int>();

            dataset2.data            = new int[] { 13, 16, 19, 22, 25, 28 };
            dataset2.backgroundColor = new string[] { "#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#4D5360", "#02B300" };
            _pie.datasets            = new List <mdl.dataset <int> >();
            _pie.datasets.Add(dataset);
            _pie.datasets.Add(dataset2);
            _pie.labels = new string[] { "产品1", "产品2", "产品3", "产品4", "产品5", "产品6" };
            context.Response.Write(tpc.j.SerializeObject(_pie));
        }