Ejemplo n.º 1
0
    private void btnGo_Click(object sender, EventArgs e)
    {
      if (m_eventSelector.Dates == null || m_eventSelector.Dates.Length == 0)
        return;

      if (string.IsNullOrEmpty(tbFutureStart.Text.Trim()))
        return;

      ultraTabControl1.Tabs.Clear();

      m_helperArgs.EventDates = m_eventSelector.Dates;
      var dict = Helper.Go(m_helperArgs);

      {
        var chart = new SeasonalityChart();
        chart.Dock = DockStyle.Fill;
        var tab = ultraTabControl1.Tabs.Add();
        tab.Text = "asdf";
        tab.TabPage.Controls.Add(chart);

        foreach (var v in dict)
          chart.AddLineChart(v);

        chart.Create();

        LookFeel.ProcessChart(chart);
      }

      // display all lines in grid
      {
        var list = dict.Select(x => new Tuple<string, DatedDataCollectionGen<double>>(x.EventDate.ToString("dd-MMM-yy HH:mm"), x.RawFutureDataAroundEvent)).ToList();
        var c = new SI.Controls.LineChartMultiArea();

        c.Create(list, "HH:mm", "###0.00#");

        var tab = ultraTabControl1.Tabs.Add();
        tab.Text = "CleanPrice movement per event";
        c.Dock = DockStyle.Fill;
        tab.TabPage.Controls.Add(c);
        LookFeel.ProcessChart(c);
      }

    }
Ejemplo n.º 2
0
    public static void Test()
    {
      int minutesBefore = 120;
      var dict = Go("NFP", TZ.LN, new DateTime(2013, 1, 1), DateTime.Today, "TY", new TimeSpan(0, minutesBefore, 0), new TimeSpan(0, 1, 0));
      var listOfLines = new List<EventAnalysisLine>();
      var dictToNormalized = new SortedDictionary<DateTime, double[]>();

      var lcd = new SI.Controls.LineChartDataDisplay();

      // display
      {
        var list = dict.ToArray().Select(x => new Tuple<string, DatedDataCollectionGen<double>>(x.Key.ToString("dd-MMM-yyyy HH:mm"), x.Value)).ToList();
        var c = new SI.Controls.LineChartMultiArea();

        int count = dict.Count();

        int root = (int)Math.Sqrt(count);

        c.Create(root, root + 1, list,"HH:mm","###0.00#");
        c.DisplayInShowForm("Test!");
      }

      foreach (DateTime date in dict.Keys)
      {
        //dict[date].DisplayLineChart(date.ToString("dd-MMM-yyyy HH:mm"));
        //var grid = dict[date].DisplayInGrid(date.ToString("dd-MMM-yyyy HH:mm"));
        //grid.Grid.DisplayLayout.Bands[0].Columns[0].Format = "dd-MMM-yyyy HH:mm:ss";

        int minIndex = 0, maxIndex = 0;
        var px = dict[date];
        if (px == null)
          continue;
        for (int i = 0; i < minutesBefore && i < px.Length; ++i)
        {
          minIndex = px.Data[i] <= px.Data[minIndex] ? i : minIndex;
          maxIndex = px.Data[i] >= px.Data[maxIndex] ? i : maxIndex;
        }

        listOfLines.Add(new EventAnalysisLine()
        {
          EventDate = date,
          IndexHighestAt = px.Dates[maxIndex],
          IndexLowestAt = px.Dates[minIndex],
          IndexHigh = px.Data[maxIndex],
          IndexLow = px.Data[minIndex]
        });

        var normalizedSeries = px.Data.Take(minutesBefore).Select(x => (x - px.Data[minIndex]) / (px.Data[maxIndex] - px.Data[minIndex])).ToArray();
        var adjustedDates = px.Dates.Take(minutesBefore).Select(x => new DateTime(2014, 1, 1, x.Hour, x.Minute, 0)).ToArray();

        lcd.AddSeries(adjustedDates, normalizedSeries, date.ToString("dd-MM"));
      }

      listOfLines.DisplayInBoundGrid(string.Format("NFP analysis t-{0}mins", minutesBefore));
      lcd.SetXAxisFormat("HH:mm");
      lcd.DisplayInShowForm(string.Format("Normalized values per event t-{0}mins", minutesBefore));
    }