protected override void OnClick(EventArgs e)
      {
        var c = new LineChartDataDisplay();
        var source = Item.GetSource();
        var series = source.OriginalPriceSeries;
        var layer = c.AddSeries(series.Dates, series.Data, "Price");
        layer.AxisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart;

        foreach (var year in source.IndividualsYears.Keys)
        {
          var vals = source.IndividualsYears[year].GetValuesBetweenDates(Item.StartDate, Item.EndDate);
          
          var s = c.AddSeries(
            dates_: vals.Dates.Select(x=>new DateTime(year,x.Month,x.Day)).ToArray(),
            values_: vals.Data,
            desc_: year.ToString(),
            color_: Color.Yellow,
            yAxisExtent_: 40,
            yLabelFormat_: "###0.0#");
          ((LineChartAppearance)s.ChartTypeAppearance).Thickness = 3;
          s.AxisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart;
        }

        c.DisplayInShowForm(string.Format("{0}   [{1} to {2}]", Item.Instrument, Item.StartDate.ToString("dd-MMM-yyyy"),
          Item.EndDate.ToString("dd-MMM-yyyy")));
      }
Esempio 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));
    }
        public void HistSeriesCandleChart()
        {
            var data = BbgData.getOHLCSeriesFromBbg(new DateTime(2015, 1, 1), "EUR Curncy", false);
            var chart = new LineChartDataDisplay();
            SI.Controls.LookFeel.ProcessControl(chart);
            chart.AddCandleSeries(data, "candle chart", 40, "###0.000");
            var max = data.GetColumnValues(1).Max();
            var min = data.GetColumnValues(2).Min();
            chart.FindYAxis(40).RangeType = AxisRangeType.Custom;
            chart.FindYAxis(40).RangeMax = max + (max - min) * 0.1;
            chart.FindYAxis(40).RangeMin = min - (max - min) * 0.1;

            var form = chart.DisplayInShowForm("DeMark Chart");
            Application.Run(form);
        }