コード例 #1
0
ファイル: HSARHViewModel.cs プロジェクト: zlkjzhm/HSTDemo
        void InitChart()
        {
            LinesDatabase.GetAtmosphereTables(out _tempsList, out _svpList, out _arhToShowList);
            for (int j = 0; j < LinesDatabase.ARH_LINE_COUNT; j++)
            {
                LineSeries ls = new LineSeries
                {
                    Values            = new ChartValues <ObservablePoint> {
                    },
                    LineSmoothness    = 0,
                    Fill              = Brushes.Transparent,
                    PointGeometrySize = 0,
                    //DataLabels = true,
                };

                VisualElement ve = new VisualElement
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    UIElement           = new HSVEControl(_arhToShowList[j])
                };
                double lastX     = 0;
                double lastY     = 0;
                bool   hasShowEV = false;
                for (int i = 0; i < LinesDatabase.TEMP_LENGTH; i++)
                {
                    //数据计算
                    double mc = HSAtmosphere.MoistureContent(_svpList[i], _arhToShowList[j], _pressure);
                    var    op = new ObservablePoint(mc, _tempsList[i]);
                    //显示线
                    ls.Values.Add(op);
                    if (!hasShowEV)
                    {
                        if (_tempsList[i] >= LinesDatabase.TEMP_MAX)
                        {
                            hasShowEV = true;
                            lastX     = mc;
                            lastY     = _tempsList[i];
                        }
                        else if (mc >= LinesDatabase.MC_MAX)
                        {
                            hasShowEV = true;
                            lastX     = LinesDatabase.MC_MAX;
                            lastY     = _tempsList[i];
                        }
                    }
                }
                _seriesCollection.Add(ls);
                //显示标志
                ve.X = lastX;
                ve.Y = lastY;
                _cartesianVisuals.Add(ve);
            }
        }
コード例 #2
0
 public void CreateTruncatedVisuaLElement(int axisX, Instant x, decimal y)
 {
     _visualElementsCollection.Add(new VisualElement
     {
         X         = x.ToUnixTimeTicks() / Parent.AxisModifier,
         Y         = (double)y,
         UIElement = new Image
         {
             ToolTip = $"This series is possibly truncated by the lean Engine due to a maximum number of points ({ 8000 }) ",
             Width   = 16,
             Source  = (BitmapImage)Application.Current.Resources["AttentionBitmapImage"],
         }
     });
 }
コード例 #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int    contr = 0;
            double x2    = 0;

            Curve[] curves = (Curve[])value;
            if (curves != null)
            {
                VisualElementsCollection result = new VisualElementsCollection();
                Curve prevLine = null;
                foreach (var curve in curves)
                {
                    Curve line = curve;
                    {
                        if (curve != null)
                        {
                            double placeX = x2 = 0.05 * Math.Log(line.Points.Max(p => p.X));
                            double distY  = line.Points.First(p => p.X > placeX).Y;
                            double placeY = Math.Log(distY * 0.7, 10);
                            if (prevLine != null)
                            {
                                double prevdistY = prevLine.Points.OrderBy(p => p.X - placeX).First().Y;
                                placeY = 0.9 * (Math.Log(distY / prevdistY, 10)) + Math.Log(prevdistY, 10);
                            }
                            result.Add(new VisualElement()
                            {
                                X = placeX, Y = placeY, UIElement = new TextBlock()
                                {
                                    Text       = curve.dU,
                                    FontWeight = FontWeights.Bold, FontSize = 15, VerticalAlignment = VerticalAlignment.Top
                                }
                            });
                        }
                    }
                    prevLine = line;
                    contr    = 1;
                }
                if (contr == 1)
                {
                    result.Add(new VisualElement()
                    {
                        X         = x2,
                        Y         = 2.903,
                        UIElement = new TextBlock()
                        {
                            Text              = "F",
                            FontWeight        = FontWeights.Bold,
                            FontSize          = 15,
                            VerticalAlignment = VerticalAlignment.Top
                        }
                    });
                }
                return(result);
            }
            else
            {
                return new VisualElementsCollection()
                       {
                           new VisualElement()
                       }
            };
        }