Example #1
0
        public override string EvaluateModelTemplate(int counter)
        {
            string        templateName = "colDivTempBar" + counter.ToString();
            BarChartModel model        = this.ChartModel as BarChartModel;
            string        colString    = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.BarCharts.BarChartScript.html", templateName);

            return(colString);
        }
Example #2
0
        public override void CreateChartModel(int counter)
        {
            BarChartModel model = new BarChartModel();

            model.Width         = this.Style.Width;
            model.Height        = this.Style.Height;
            model.YAxisLabel    = this.Style.YAxisLabel;
            model.TickMarksX    = this.Style.TickMarksX.ToString();
            model.BarFill       = ChartsUtilities.ColorToHexString(this.Style.BarColor);
            model.BarHover      = ChartsUtilities.ColorToHexString(this.Style.BarHoverColor);
            model.DivId         = "div" + counter.ToString();
            model.xTextRotation = this.Style.xTextRotation;
            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.Data.Domain == null)
            {
                model.Domain = false;
            }
            else
            {
                model.Domain  = true;
                model.DomainA = this.Data.Domain.A.ToString();
                model.DomainB = this.Data.Domain.B.ToString();
            }

            // serialize C# Array into JS Array
            var    serializer = new JavaScriptSerializer();
            string jsData     = serializer.Serialize(this.Data.Data);

            model.Data = jsData;

            this.ChartModel = model;
        }