Beispiel #1
0
        public void AddAxisX(AxisVisual axis)
        {
            GenerateId(axis);

            XAxes.Add(axis);
            All.Add(axis);

            XMappings.Add(axis.Id, axis);
            axis.DataSource = this;
        }
Beispiel #2
0
        public void AddAxisY(AxisVisual axis)
        {
            GenerateId(axis);

            YAxes.Add(axis);
            All.Add(axis);

            InitMappings();

            YMappings.Add(axis.Id, axis);
            axis.DataSource = this;
        }
Beispiel #3
0
 public void InitMappings()
 {
     AxisMappings.Clear();
     SeriesMappings.Clear();
     //Y轴和series的映射
     //通过Name一一对应
     foreach (var item in Series)
     {
         var        axis_id   = int.MinValue;
         var        series_id = int.MinValue;
         AxisVisual axis      = null;
         var        index     = 0;
         foreach (var yAxis in YAxes)
         {
             if (index == 0 || (item.YAxisIds != null && item.YAxisIds.Contains(yAxis.Id)))
             {
                 axis_id   = yAxis.Id;
                 series_id = item.Id;
                 axis      = yAxis;
             }
             index++;
         }
         if (!AxisMappings.ContainsKey(axis_id))
         {
             AxisMappings[axis_id] = new List <SeriesVisual>();
         }
         if (!SeriesMappings.ContainsKey(series_id))
         {
             SeriesMappings[series_id] = new List <AxisVisual>();
         }
         AxisMappings[axis_id].Add(item);
         if (axis != null)
         {
             SeriesMappings[series_id].Add(axis);
         }
         else
         {
             SeriesMappings[series_id].AddRange(YAxes);
         }
     }
     if (Series.Count == 0)
     {
         if (!SeriesMappings.ContainsKey(int.MinValue))
         {
             SeriesMappings[int.MinValue] = new List <AxisVisual>();
         }
         SeriesMappings[int.MinValue].AddRange(YAxes);
     }
 }