示例#1
0
        public static void SetCmdrPics(ChartJS chart)
        {
            if (chart.type != "bar")
            {
                return;
            }

            List <ChartJSPluginlabelsImage> images = new List <ChartJSPluginlabelsImage>();

            foreach (string lcmdr in chart.data.labels)
            {
                foreach (string cmdr in DSdata.s_races)
                {
                    if (lcmdr.StartsWith(cmdr))
                    {
                        ChartJSPluginlabelsImage myimage = new ChartJSPluginlabelsImage();
                        myimage.src = "images/btn-unit-hero-" + cmdr.ToLower() + ".png";
                        images.Add(myimage);
                    }
                }
            }
            ChartJsoptionsBar opt = new ChartJsoptionsBar();

            opt = chart.options as ChartJsoptionsBar;
            opt.plugins.labels.images = images;
            chart.options             = opt;
        }
示例#2
0
        public ChartJsoptions GetOptions()
        {
            ChartJsoptions chartoptions = new ChartJsoptions();


            if (_options.Mode == "Synergy" || _options.Mode == "AntiSynergy")
            {
                ChartJsoptionsradar radaroptions = new ChartJsoptionsradar();
                radaroptions.title.text      = _options.Mode;
                radaroptions.legend.position = "bottom";
                if (_options.Player == true)
                {
                    radaroptions.title.text = "Player " + radaroptions.title.text;
                }
                chartoptions = radaroptions;
            }
            else
            {
                ChartJsoptionsBar baroptions = new ChartJsoptionsBar();
                chartoptions = baroptions;

                ChartJSoptionsScalesY yAxes = new ChartJSoptionsScalesY();
                yAxes.scaleLabel.labelString = "% - " + _options.Startdate.ToString("yyyy-MM-dd") + " - " + _options.Enddate.ToString("yyyy-MM-dd") + " - " + IsDefaultFilter();
                if (_options.BeginAtZero == true)
                {
                    yAxes.ticks.beginAtZero = true;
                }

                chartoptions.scales.yAxes.Add(yAxes);
            }

            chartoptions.title.display = true;
            chartoptions.title.text    = _options.Mode;
            if (_options.Player == true)
            {
                chartoptions.title.text = "Player " + chartoptions.title.text;
            }
            return(chartoptions);
        }