Пример #1
0
        /*
         * @author      :   AC <*****@*****.**>
         * @date        :   NOV. 28 2016 12:39 PM
         * @description :   prepare chart config for building the chart
         * @parameters  :
         *
         * @return      :   string object
         */
        #region BuildChart
        public string BuildChart()
        {
            Dictionary <string, object> chart_params = new Dictionary <string, object>();
            Dictionary <string, object> chartSeries  = new Dictionary <string, object>();
            Dictionary <string, object> dataLabels   = new Dictionary <string, object>();

            string x = "";
            string categories_str = "GP001,GP002,GP003,GP004,GP005";

            String[] categories_arr = categories_str.Split(',');
            chartSeries.Add("name", "[employee_name]");
            chartSeries.Add("data", new[] { 5, 7, -3, 2, -5 });

            dataLabels.Add("enabled", true);
            dataLabels.Add("format", "{point.y:.1f}%");

            chart_params.Add("legend", new Dictionary <string, object>()
            {
                { "enabled", false }
            });
            chart_params.Add("chart", new Dictionary <string, string>()
            {
                { "type", "column" }
            });
            chart_params.Add("title", new Dictionary <string, string>()
            {
                { "text", string.Empty }
            });
            chart_params.Add("xAxis", new Dictionary <string, object>()
            {
                { "categories", categories_arr }
            });
            chart_params.Add("series", new[] { chartSeries });
            x = custom_helper.BuildChart(chart_params, "chartid");

            return(x);
        }