コード例 #1
0
        public override void CreateChartModel(int counter)
        {
            NormalizedStackedBarChartModel model = new NormalizedStackedBarChartModel();

            model.Width      = this.Style.Width;
            model.Height     = this.Style.Height;
            model.YAxisLabel = this.Style.YAxisLabel;
            model.BarHover   = ChartsUtilities.ColorToHexString(this.Style.BarHoverColor);
            model.DivId      = "div" + counter.ToString();
            model.Margins    = this.Style.Margins;

            // set grid address
            model.GridRow    = this.Style.GridRow;
            model.GridColumn = this.Style.GridColumn;

            // always round up for the grid size so chart is smaller then container
            model.SizeX = (int)System.Math.Ceiling(this.Style.Width / 100d);
            model.SizeY = (int)System.Math.Ceiling(this.Style.Height / 100d);

            if (this.Style.Colors != null)
            {
                string domainColors = new JavaScriptSerializer().Serialize(this.Style.Colors);
                model.DomainColors = domainColors;
                model.Colors       = true;
            }
            else
            {
                model.Colors = false;
            }

            model.Data = this.Data.ToJsonString();

            this.ChartModel = model;
        }
コード例 #2
0
        public override string EvaluateModelTemplate(int counter)
        {
            string templateName = "colDivTempNormalizedStackedBar" + counter.ToString();
            NormalizedStackedBarChartModel model = this.ChartModel as NormalizedStackedBarChartModel;
            string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.NormalizedStackedBarChart.NormalizedStackedBarChart.html", templateName);

            return(colString);
        }