private DockPanel MakeValueText(SeriesData seriesData) { DockPanel dock = new DockPanel() { LastChildFill = false, VerticalAlignment = VerticalAlignment.Center }; var ellipse = new Ellipse() { Width = 10, Height = 10, Fill = seriesData.Color, Margin = new Thickness(0, 0, 5, 0), VerticalAlignment = VerticalAlignment.Center }; dock.AddChild(ellipse, Dock.Left); if (!string.IsNullOrEmpty(seriesData.Name)) { dock.AddChild(new TextBlock() { Text = $"{seriesData.Name}: " }, Dock.Left); } dock.AddChild(new TextBlock() { Text = $"{seriesData.AxisY.GetStringValue(seriesData.YValue)}{seriesData.AxisY.Unit}" }, Dock.Left); return(dock); }
public CreateWholeFrame(string Name, inputType type) { Label label = new Label() { Content = Name, FontSize = 14, Padding = new System.Windows.Thickness(2), }; if (type == inputType.Password) { box = new PasswordBox() { MaxHeight = 20, MaxLength = 150, MinWidth = 100 }; (box as PasswordBox).PasswordChar = '*'; } else { box = new TextBox() { MaxHeight = 20, MaxLength = 150, MinWidth = 100 }; } dock.AddChild(label, Dock.Left); dock.AddChild(box, Dock.Left); Content = dock; Margin = new Thickness(5); }
public NormalToolTip() { Visibility = Visibility.Collapsed; layers.Children.Add(dock); border.Child = layers; Content = border; dock.AddChild(XText, Dock.Top); dock.AddChild(dock_content, Dock.Top); }
public Strength() { lineSeries2.PointStyle = new EllipsePointStyle() { }; axisX.MinUnit = 600000; BorderThickness = new Thickness(1); BorderBrush = Brushes.Black; chart.IntersectChanged += Chart_IntersectChanged; chart.Offsets = new PaddingOffset(50, 20, 20, 20); axisX.IsInterregional = false; chart.AddAsixY(axisY); chart.AddAsixY(axisY2); chart.AddAsixX(axisX); chart.AddSeries(lineSeries); chart.AddSeries(lineSeries2); chart.AddSeries(lineSeries3); chart.AddSeries(lineSeries4); DrawingCanvas.AddChild(chart); DrawingCanvas.DataSource = chart.DataSource; IsVisibleChanged += ChartItem_IsVisibleChanged; DockPanel dock = new DockPanel(); DockPanel title = new DockPanel(); title.VerticalAlignment = VerticalAlignment.Center; title.AddChild(new TextBlock() { Text = "强弱评级" }, Dock.Left); title.AddChild(text1, Dock.Left); text2.Margin = new Thickness(10, 0, 0, 0); title.AddChild(text2, Dock.Right); dock.AddChild(title, Dock.Top); dock.AddChild(DrawingCanvasArea, Dock.Top); Content = dock; SizeChanged += Strength_SizeChanged; }
public override void PushData(List <SeriesData> series) { dock_content.Children.Clear(); //TODO 这部分后续需要支持多轴 if (series == null || series.Count <= 0) { Visibility = Visibility.Collapsed; return; } Visibility = Visibility.Visible; var se = series[0]; var value = se.AxisX.GetStringValue(se.XValue); XText.Text = !string.IsNullOrEmpty(se.AxisX.Name) ? $"{se.AxisX.Name}: {value}{se.AxisX.Unit}" : $"{value}{se.AxisX.Unit}"; foreach (var item in series) { dock_content.AddChild(MakeValueText(item), Dock.Top); } //dock_content.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); //Layers.Width = dock_content.DesiredSize.Width + dock.Margin.Left + dock.Margin.Right + border.Padding.Left + border.Padding.Right + TextContainer.Margin.Left + TextContainer.Margin.Right; //Layers.Height = dock_content.DesiredSize.Height + dock.Margin.Top + dock.Margin.Bottom + border.Padding.Top + border.Padding.Bottom + TextContainer.Margin.Top + TextContainer.Margin.Bottom; }
public WindowCharting() { chartCanvas.Background = Brushes.White; Timer timer = new Timer(1000); timer.Elapsed += Timer_Elapsed; timer.Start(); DockPanel grid = new DockPanel() { }; axisY3.Offsets = new PaddingOffset(0, 0, 50, 0); axisX3.Offsets = new PaddingOffset(0, 0, 0, 60); var ratios = new List <double>() { 0.2, 0.3, 0.3, 0.2 }; ratios.Insert(0, 0); axisX.Ratios = ratios; axisX2.Ratios = ratios; axisX3.Ratios = ratios; axisX.IsInterregional = false; axisX.AxisPen = new Pen(Brushes.Red, 1); axisX2.AxisPen = new Pen(Brushes.PeachPuff, 1); axisX3.AxisPen = new Pen(Brushes.DarkCyan, 1); AxisInteractionCanvas interaction = new AxisInteractionCanvas(); chartCanvas.DrawingCanvas.AddChild(chart); chartCanvas.DrawingCanvas.DataSource = chart.DataSource; RectInteractionGroup container = new RectInteractionGroup(interaction, 1, 1, chartCanvas); BlurryUserControl b = new BlurryUserControl() { Background = new SolidColorBrush(ColorHelper.StringToColor("#BE323337")).OfStrength(0.2d) }; b.BlurContainer = container.ContainerGrid; b.Magnification = 0.25; b.BlurRadius = 30; interaction.Tip.Layers.Children.Insert(0, b); interaction.Cross.IsCrossShow = true; chart.AddAsixX(axisX); chart.AddAsixX(axisX2); chart.AddAsixX(axisX3); //ValueAxis axisY2 = new ValueAxis(AxisPosition.Left) { ValueFormat = "F1" }; //axisY2.Offsets.Left = new GridLength(50); //asix.AddAsixY(axisY2); chart.AddAsixY(axisY); chart.AddAsixY(axisY2); chart.AddAsixY(axisY3); StraightLineSeriesVisual lineSeries = new StraightLineSeriesVisual() { }; StraightLineSeriesVisual lineSeries2 = new StraightLineSeriesVisual() { }; chart.AddSeries(lineSeries); chart.AddSeries(lineSeries2); //asix.PaddingOffset.Left = new GridLength(0.1, GridUnitType.Star); //asix.PaddingOffset.Top = new GridLength(0.1, GridUnitType.Star); //asix.PaddingOffset.Right = new GridLength(0.1, GridUnitType.Star); //asix.PaddingOffset.Buttom = new GridLength(0.1, GridUnitType.Star); chart.Offsets = new PaddingOffset(50); var now = DateTime.Now; Random random = new Random(); var max = 1000; Dictionary <DateTime, double> dic = new Dictionary <DateTime, double>(); Dictionary <DateTime, double> dic2 = new Dictionary <DateTime, double>(); for (int i = 0; i < 4; i++) { dic.Add(now.AddDays(i), random.NextDouble() * max); } for (int i = 0; i < 3; i++) { dic2.Add(now.AddDays(i), random.NextDouble() * max); } lineSeries2.LinePen.Brush = Brushes.Red; lineSeries2.VisualData = dic2.ToFormatVisualData(); lineSeries.VisualData = dic.ToFormatVisualData(); //Dictionary<DateTime, double> dic3 = new Dictionary<DateTime, double>(); chart.Plot(); //TestVisual test = new TestVisual(axisRect); //chartCanvas.AddChild(test); //test.VisualData = null; grid.AddChild(container, Dock.Left); //grid.Children.Add(new TextBlock() { Text = "123"}); Content = grid; this.SizeChanged += WindowCharting_SizeChanged; }