private void SetItemsSource(Point point, ISupportAxes2D series)
 {
     try
     {
         var    chartSeries = series as ChartSeries;
         double pointx      = Math.Truncate(ChartArea.PointToValue(series.ActualXAxis, point));
         double pointy      = Math.Truncate(ChartArea.PointToValue(series.ActualYAxis, point));
         if (chartSeries == null || (!(pointx >= 0) || !(pointx < chartSeries.DataCount)))
         {
             return;
         }
         customInfo = new ChartCustomInfo
         {
             LabelX = chartSeries.Label,
             LabelY = ChartArea.SecondaryAxis.Header.ToString()
         };
         var dataSource = chartSeries.ItemsSource as List <StockData>;
         if (dataSource != null)
         {
             customInfo.ValueX = dataSource[(int)pointx].TimeStamp.ToString("MM-dd-yyyy");
         }
         customInfo.ValueY       = pointy.ToString(series.ActualYAxis.LabelFormat, CultureInfo.CurrentCulture);
         customInfo.YValues      = GetYValuesBasedOnIndex(pointx, chartSeries);
         yCount                  = customInfo.YValues.Count;
         customInfo.LabelYValues = GetLabelYValues();
         customInfo.Visibility   = Visibility.Visible;
         PointInfos.Add(customInfo);
         PositionSummaryControl(pointx, chartSeries);
     }
     catch
     {
     }
 }
Beispiel #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ChartCustomInfo obj = value as ChartCustomInfo;

            return(obj.LabelX + " " + "|" + " " + obj.ValueX.ToString());
        }