private void addAreas()
    {

      if (ultraChart.CompositeChart.ChartAreas.Count > 2)
        return;

      ultraChart.CompositeChart.ChartAreas.Clear();

      int areaWidth = (int)100 / m_cols;
      int areaHeight = (int)100 / m_rows;

      for (int i = 0; i < m_data.Count(); ++i)
      {
        Label l = new Label();
        l.Font = new Font("Tahoma", 5.75F, FontStyle.Regular);
        l.Text = m_data[i].Item1;
        l.ForeColor = Color.White;
        Controls.Add(l);
        l.BringToFront();
        l.BackColor = Color.White;
        l.AutoSize = true;
        lbls.Add(l);

        ChartArea area = new ChartArea();
        AxisItem xAxis = new AxisItem();
        AxisItem yAxis = new AxisItem();

        xAxis.Key = string.Format("xAxis_{0}", i.ToString());
        xAxis.DataType = Infragistics.UltraChart.Shared.Styles.AxisDataType.Time;
        xAxis.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing;
        xAxis.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.Custom;
        xAxis.Labels.ItemFormatString = string.Format("<ITEM_LABEL:{0}>",m_xAxisLabelFormatString);
        xAxis.Labels.Font = new Font("Tahoma", 5.75F);
        xAxis.MajorGridLines.Visible = true;
        xAxis.OrientationType = Infragistics.UltraChart.Shared.Styles.AxisNumber.X_Axis;
        xAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries;
        xAxis.Extent = 20;

        yAxis.Key = string.Format("yAxis_{0}", i.ToString());
        yAxis.DataType = Infragistics.UltraChart.Shared.Styles.AxisDataType.Numeric;
        yAxis.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal;
        yAxis.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.Custom;
        yAxis.Labels.HorizontalAlign = StringAlignment.Near;
        yAxis.Labels.Font = new Font("Tahoma", 5.75F);
        yAxis.Labels.ItemFormatString = string.Format("<DATA_VALUE:{0}>", m_yAxisLabelFormatString);
        yAxis.MajorGridLines.Visible = true;
        yAxis.OrientationType = Infragistics.UltraChart.Shared.Styles.AxisNumber.Y_Axis;
        yAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries;
        yAxis.Extent = 15;

        area.Axes.Add(xAxis);
        area.Axes.Add(yAxis);
        area.Key = string.Format("area_{0}", i.ToString());

        int x = i, y = 0;

        while (x > (m_cols-1))
        {
          ++y;
          x -= m_cols;
        }

        area.Bounds = new Rectangle(areaWidth * x, areaHeight * y, areaWidth, areaHeight);
        area.BoundsMeasureType = Infragistics.UltraChart.Shared.Styles.MeasureType.Percentage;

        ultraChart.CompositeChart.ChartAreas.Add(area);

        for (int j = 0; j < 1; ++j)
        {
          DataTable d = new DataTable();
          d.Columns.Add("Date", typeof(DateTime));
          d.Columns.Add("Px", typeof(double));

          NumericTimeSeries ns = new NumericTimeSeries();
          ns.Data.TimeValueColumn = "Date";
          ns.Data.ValueColumn = "Px";
          ns.Key = string.Format("series_{0}_{1}", i.ToString(), j.ToString());
          ultraChart.CompositeChart.Series.Add(ns);

          ChartLayerAppearance chart = new ChartLayerAppearance();
          chart.ChartComponent = ultraChart;
          chart.ChartArea = area;
          chart.AxisX = area.Axes[0];
          chart.AxisY = area.Axes[1];
          chart.ChartType = ChartType.LineChart;
          chart.Key = string.Format("chart_{0}_{1}", i.ToString(), j.ToString());

          LineChartAppearance lca = (LineChartAppearance)chart.ChartTypeAppearance;
          lca.Thickness = 1;
          lca.MidPointAnchors = false;
          lca.EndStyle = LineCapStyle.NoAnchor;

          ultraChart.CompositeChart.ChartLayers.Add(chart);
          chart.Series.Add(ns);
          ns.Data.DataSource = d;
          chart.SeriesList = ns.Key;
          ns.DataBind();
          ns.PEs.Add(new PaintElement(Color.LightGray));

          dts.Add(d);
        }
      }

    }
    private void InitializeComponent()
    {
            this.panel1 = new SI.Controls.Panel();
            this.tbBbgOverride = new SI.Controls.BoundTextBox();
            this.lblField = new SI.Controls.Label();
            this.cmbField = new SI.Controls.BoundComboBox();
            this.button1 = new SI.Controls.Button();
            this.label1 = new SI.Controls.Label();
            this.tbBbgTicker = new SI.Controls.BoundTextBox();
            this.panel1.ClientArea.SuspendLayout();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.tbBbgOverride)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbField)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.tbBbgTicker)).BeginInit();
            this.SuspendLayout();
            // 
            // panel1
            // 
            // 
            // panel1.ClientArea
            // 
            this.panel1.ClientArea.Controls.Add(this.tbBbgOverride);
            this.panel1.ClientArea.Controls.Add(this.lblField);
            this.panel1.ClientArea.Controls.Add(this.cmbField);
            this.panel1.ClientArea.Controls.Add(this.button1);
            this.panel1.ClientArea.Controls.Add(this.label1);
            this.panel1.ClientArea.Controls.Add(this.tbBbgTicker);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(818, 42);
            this.panel1.TabIndex = 3;
            // 
            // tbBbgOverride
            // 
            this.tbBbgOverride.Location = new System.Drawing.Point(478, 3);
            this.tbBbgOverride.Name = "tbBbgOverride";
            this.tbBbgOverride.Size = new System.Drawing.Size(286, 21);
            this.tbBbgOverride.TabIndex = 6;
            // 
            // lblField
            // 
            this.lblField.AutoSize = true;
            this.lblField.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
            this.lblField.Location = new System.Drawing.Point(276, 7);
            this.lblField.Name = "lblField";
            this.lblField.Size = new System.Drawing.Size(29, 14);
            this.lblField.TabIndex = 5;
            this.lblField.Text = "Field";
            // 
            // cmbField
            // 
            this.cmbField.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
            this.cmbField.Location = new System.Drawing.Point(311, 3);
            this.cmbField.Name = "cmbField";
            this.cmbField.Size = new System.Drawing.Size(161, 21);
            this.cmbField.TabIndex = 4;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(770, 3);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(36, 23);
            this.button1.TabIndex = 3;
            this.button1.Text = "Go";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
            this.label1.Location = new System.Drawing.Point(3, 7);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(89, 14);
            this.label1.TabIndex = 0;
            this.label1.Text = "Bloomberg ticker";
            // 
            // tbBbgTicker
            // 
            this.tbBbgTicker.Location = new System.Drawing.Point(98, 3);
            this.tbBbgTicker.Name = "tbBbgTicker";
            this.tbBbgTicker.Size = new System.Drawing.Size(135, 21);
            this.tbBbgTicker.TabIndex = 1;
            // 
            // BloombergSeriesDataAroundEventControl2
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.Controls.Add(this.panel1);
            this.Name = "BloombergSeriesDataAroundEventControl2";
            this.Size = new System.Drawing.Size(818, 42);
            this.panel1.ClientArea.ResumeLayout(false);
            this.panel1.ClientArea.PerformLayout();
            this.panel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.tbBbgOverride)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbField)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.tbBbgTicker)).EndInit();
            this.ResumeLayout(false);

    }
        private void ApplyData(EventDataItem eventData, SeasonalityChartAndGrid chart, Label eventLabel, UltraTextEditor ssInto, UltraTextEditor ssOut, UltraTextEditor rssInto, UltraTextEditor rssOut, SeasonalityChartAndGrid chartAndGridOverlay)
        {            
            //var con = Helper.TransformToCon(dataAroundEvents, 15, DataAroundEventField.Filled_Diff);
            var conAndShift = Helper.TransformToCompoChartDataAndShift(eventData.DataAroundEvents, 15, DataAroundEventField.RawDataAroundEvent_Diffs);
            var conForProbability = Helper.TransformToCompoChartDataAndShift(eventData.DataAroundEvents, 15, DataAroundEventField.RawDataAroundEvent_Diffs);
            
            var con = conAndShift.Item1;
            var shift = conAndShift.Item2;
            var closestEvent = conAndShift.Item3;
            con.Name = eventData.EventCode;
            var avgsAndProb = ViewModel.ComputeAvgsAndProb(con, conForProbability, shift);
            var avgs = avgsAndProb.Item1;
            var Probs = avgsAndProb.Item2;

            chart.Chart.VerticalLineShift = shift+1;
            chart.ApplyData(eventData.EventCode + "\n" + closestEvent.ToString("yyyy-MMM-dd"), con.ColumnHeadings, avgs);
            SetYAxix(chart);
            chart.Chart.AddLegend();
            eventLabel.Text = eventData.EventCode;

            chartAndGridOverlay.ApplyData(eventData.EventCode + "\n" + closestEvent.ToString("yyyy-MMM-dd"), con.ColumnHeadings, avgs);
            chartAndGridOverlay.Chart.VerticalLineShift = shift + 1;

            // probability
            chart.Chart.AddColumnChart(eventData.EventCode + " prob", conForProbability.Item1.ColumnHeadings, Probs, ProbabilityCalc.GetMaxValue(ViewModel.ProbCalcMethod));

            // apply stats
            ssInto.Text = ViewModel.ComputeSSInto(con, shift).ToString();
            ssOut.Text = ViewModel.ComputeSSOut(con, shift).ToString();
            rssInto.Text = ViewModel.ComputeRSSInto(con, shift).ToString();
            rssOut.Text = ViewModel.ComputeRSSOut(con, shift).ToString();
        }