internal void GetLineStudyToAdd(ChartPanel chartPanel) { _currentPanel = chartPanel; chartPanel._lineStudyToAdd = _lineStudyToAdd; _lineStudyToAdd.SetChartPanel(chartPanel); }
internal void FireChartPanelPaint(ChartPanel chartPanel) { if (ChartPanelPaint != null) { ChartPanelPaint(this, new ChartPanelPaintEventArgs(chartPanel)); } }
private void ReadSeries(XmlNode xRoot) { XmlNode xmlSeries = xRoot.SelectSingleNode("SeriesCollection"); if (xmlSeries == null) { return; } int useablePanelsCount = UseablePanelsCount; foreach (XmlNode node in xmlSeries.ChildNodes) { if (node.Name != "Series") { continue; } int panelIndex = ConvertFromXmlEx("PanelIndex", node, -1); if (panelIndex == -1) { continue; } if (panelIndex >= useablePanelsCount) { panelIndex = 0; } ChartPanel chartPanel = GetPanelByIndex(panelIndex); string seriesName = ConvertFromXmlEx("Name", node, string.Empty); if (seriesName.Length == 0) { continue; } SeriesTypeEnum seriesTypeSeries = (SeriesTypeEnum)Enum.Parse(typeof(SeriesTypeEnum), ConvertFromXmlEx("SeriesTypeSeries", node, SeriesTypeEnum.stUnknown.ToString())); SeriesTypeOHLC ohlc = (SeriesTypeOHLC)Enum.Parse(typeof(SeriesTypeOHLC), ConvertFromXmlEx("OHLCType", node, string.Empty)); SeriesTypeEnum seriesType = (SeriesTypeEnum)Enum.Parse(typeof(SeriesTypeEnum), ConvertFromXmlEx("SeriesType", node, string.Empty)); Series series = chartPanel.CreateSeries(seriesName, ohlc, seriesTypeSeries != SeriesTypeEnum.stUnknown ? seriesTypeSeries : seriesType); if (series == null) { continue; } series.SeriesType = seriesType; string upColor = ConvertFromXmlEx("UpColor", node, string.Empty); string downColor = ConvertFromXmlEx("DownColor", node, string.Empty); series.StrokeThickness = ConvertFromXmlEx("StrokeThicknes", node, 1.0); series.StrokeColor = Utils.StringToColor(ConvertFromXmlEx("StrokeColor", node, string.Empty)); series._selectable = ConvertFromXmlEx("Selectable", node, false); series.Visible = ConvertFromXmlEx("Visible", node, true); series.StrokePattern = (LinePattern)Enum.Parse(typeof(LinePattern), ConvertFromXmlEx("StrokePattern", node, "Solid")); series.UpColor = upColor.Length > 0 ? Utils.StringToColor(upColor) : (Color?)null; series.DownColor = downColor.Length > 0 ? Utils.StringToColor(downColor) : (Color?)null; series.SeriesIndex = ConvertFromXmlEx("SeriesIndex", node, 0); _dataManager.AddSeries(series.Name, series.OHLCType); _dataManager.BindSeries(series); } }
internal void ShowOnPanel(ChartPanel chartPanel) { Rect rcPanelPaintBounds = chartPanel.CanvasRect; Canvas.SetTop(this, chartPanel.Top); Canvas.SetLeft(this, rcPanelPaintBounds.Left); Width = rcPanelPaintBounds.Width; }
///<summary> /// Ctor ///</summary> ///<param name="panel"></param> ///<param name="x"></param> ///<param name="y"></param> ///<param name="price"></param> ///<param name="timestamp"></param> public ChartPanelMouseLeftClickEventArgs(ChartPanel panel, double x, double y, double price, DateTime?timestamp) { Panel = panel; X = x; Y = y; Price = price; Timestamp = timestamp; }
private static void CloseBoxPropertyChangedCallback(DependencyObject o, DependencyPropertyChangedEventArgs args) { ChartPanel chartPanel = (ChartPanel)o; if (chartPanel._titleBar != null) { chartPanel._titleBar.CloseBox = (bool)args.NewValue; } }
internal virtual void MoveToPanel(ChartPanel chartPanel) { //each type of series has its own implementation //they will call base at the end to move linked series foreach (Series series in _linkedSeries) { series.MoveToPanel(chartPanel); } }
internal override void MoveToPanel(ChartPanel chartPanel) { RemovePaint(); _chartPanel.DeleteSeries(this); _chartPanel = chartPanel; _chartPanel.AddSeries(this); base.MoveToPanel(chartPanel); }
internal void InitFromPanel(ChartPanel chartPanel) { Rect rcPanelBounds = chartPanel.CanvasRect; Canvas.SetTop(this, chartPanel.Top); Canvas.SetLeft(this, rcPanelBounds.Left); Width = rcPanelBounds.Width; Height = rcPanelBounds.Height + chartPanel.TitleBarHeight; IsOkToMove = false; }
internal void AddPanel(ChartPanel chartPanel) { Button btnPanel = CreatePanelButton(chartPanel); if (_rootPanel != null) { _rootPanel.Children.Add(btnPanel); } _panels.Add(chartPanel, btnPanel); }
internal void DeletePanel(ChartPanel chartPanel) { Button btnPanel; if (!_panels.TryGetValue(chartPanel, out btnPanel)) { return; } _panels.Remove(chartPanel); _rootPanel.Children.Remove(btnPanel); }
internal bool FireChartPanelBeforeClose(ChartPanel chartPanel) { ChartPanelBeforeCloseEventArgs args = new ChartPanelBeforeCloseEventArgs(chartPanel); if (ChartPanelBeforeClose != null) { ChartPanelBeforeClose(this, args); return(args.CancelClose); } return(args.CancelClose); }
internal override void MoveToPanel(ChartPanel chartPanel) { if (_priceStyle != null) { _priceStyle.RemovePaint(); } //Debug.Assert(_priceStyleType == PriceStyleEnum. || _priceStyleType == PriceStyleEnum.psHeikinAshi); _chartPanel.DeleteSeries(this); _chartPanel = chartPanel; _chartPanel.AddSeries(this); base.MoveToPanel(chartPanel); }
/// <summary> /// Initializes the <see cref="ChartPanelMoreIndicatorPanel"/> /// </summary> /// <param name="chartPanel"></param> /// <param name="lineStudies"></param> /// <param name="position"></param> public void Init(ChartPanel chartPanel, IEnumerable <LineStudy> lineStudies, ChartPanelMoreIndicatorPosition position) { _items.Clear(); ItemsSource = _items; foreach (LineStudy lineStudy in lineStudies) { _items.Add(new PanelItem { Name = lineStudy.StudyType.ToString(), Value = lineStudy.ToString(), LineStudy = new WeakReference(lineStudy), }); } _chartPanel = chartPanel; }
private void SeriesMoving(MouseEventArgs e) { MoveSeriesIndicator.MoveStatusEnum moveStatusEnum = CanStartMoveSeries(_seriesSelected); object o; ObjectFromCursor objectFromCursor = _chartX.GetObjectFromCursor(out o); _chartPanelToMoveTo = null; if (moveStatusEnum == MoveSeriesIndicator.MoveStatusEnum.CantMove) { _moveStatusEnum = MoveSeriesIndicator.MoveStatusEnum.CantMove; } else { switch (objectFromCursor) { case ObjectFromCursor.PanelRightYAxis: case ObjectFromCursor.PanelLeftYAxis: if (_chartX.MaximizedPanel != null) { _moveStatusEnum = MoveSeriesIndicator.MoveStatusEnum.CantMove; } else { _moveStatusEnum = moveStatusEnum == MoveSeriesIndicator.MoveStatusEnum.MoveToNewPanel ? moveStatusEnum : MoveSeriesIndicator.MoveStatusEnum.CantMove; } break; case ObjectFromCursor.PanelRightNonPaintableArea: case ObjectFromCursor.PanelPaintableArea: case ObjectFromCursor.PanelLeftNonPaintableArea: _chartPanelToMoveTo = (ChartPanel)o; _moveStatusEnum = _chartPanelToMoveTo._index != _index ? MoveSeriesIndicator.MoveStatusEnum.MoveToExistingPanel : MoveSeriesIndicator.MoveStatusEnum.CantMove; break; } } _panelsContainer.ShowMoveSeriesIndicator(_panelsContainer.ToPanelsHolder(e), _moveStatusEnum); }
internal void PanelGotNewState(ChartPanel chartPanel) { switch (chartPanel.State) { case ChartPanel.StateType.Maximized: if (_btnMaximize != null) { _btnMaximize.Content = "2"; } break; case ChartPanel.StateType.Normal: if (_btnMaximize != null) { _btnMaximize.Content = "1"; } break; } }
internal Series(string name, SeriesTypeEnum seriesType, SeriesTypeOHLC seriesTypeOHLC, ChartPanel chartPanel) { _name = name; _seriesType = seriesType; _chartPanel = chartPanel; _seriesTypeOHLC = seriesTypeOHLC; ShowInHeatMap = false; UseEnhancedColoring = false; WickUpStroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0x00)); // Lime WickDownStroke = new SolidColorBrush(Colors.Red); WickStrokeThickness = 1.0; CandleUpFill = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0x00)); // Lime CandleDownFill = new SolidColorBrush(Colors.Red); CandleUpStroke = null; CandleDownStroke = null; CandleStrokeThickness = 0; }
private static void OnYAxesBackgroundChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs) { ChartPanel chartPanel = (ChartPanel)sender; if (chartPanel == null) { return; } if (chartPanel._leftYAxis != null) { chartPanel._leftYAxis.Background = (Brush)eventArgs.NewValue; } if (chartPanel._rightYAxis != null) { chartPanel._rightYAxis.Background = (Brush)eventArgs.NewValue; } }
private Button CreatePanelButton(ChartPanel chartPanel) { string title = chartPanel.Title; PanelsBarButton btnPanel = new PanelsBarButton { Content = title, Width = Constants.PanelsBarButtonWidth, Margin = new Thickness(2, 1, 1, 1), Foreground = Brushes.White, #if WPF ToolTip = title, #endif }; btnPanel.Click += (sender, e) => { if (OnButtonClicked != null) { OnButtonClicked(this, new PanelsBarButtonClick(chartPanel)); } }; return(btnPanel); }
/// <summary> /// Initializes a new instance of the <see cref="ChartPanelBeforeCloseEventArgs"/> class. /// </summary> /// <param name="chartPanel">Reference to chart panel</param> public ChartPanelBeforeCloseEventArgs(ChartPanel chartPanel) { ChartPanel = chartPanel; CancelClose = false; }
/// <summary> /// Constructor /// </summary> /// <param name="chartPanel"></param> /// <param name="oldStatus"></param> /// <param name="newStatus"></param> public ChartPanelStatusChangedEventArgs(ChartPanel chartPanel, ChartStatus oldStatus, ChartStatus newStatus) { ChartPanel = chartPanel; OldStatus = oldStatus; NewStatus = newStatus; }
/// <summary> /// ctor /// </summary> /// <param name="chartPanel"></param> public PanelsBarButtonClick(ChartPanel chartPanel) { _chartPanel = chartPanel; }
internal void SetChartPanel(ChartPanel chartPanel) { _chartPanel = chartPanel; BindButtons(); }
internal void DeleteMinimizedPanel(ChartPanel panel) { _panelsBar.DeletePanel(panel); SetPanelsBarVisibility(); }
internal void MoveSeriesTo(Series seriesToMove, ChartPanel chartPanelToMoveTo, MoveSeriesIndicator.MoveStatusEnum moveStatusEnum) { _panelsContainer.HideMoveSeriesIndicator(); _chartX.Status = StockChartX.ChartStatus.Ready; seriesToMove.HideSelection(); _rootCanvas.ReleaseMouseCapture(); if (moveStatusEnum == MoveSeriesIndicator.MoveStatusEnum.CantMove) { return; } ChartPanel chartPanel = (moveStatusEnum == MoveSeriesIndicator.MoveStatusEnum.MoveToNewPanel ? null : chartPanelToMoveTo) ?? _chartX.AddChartPanel(); chartPanel._enforceSeriesSetMinMax = true; seriesToMove.Painted = false; seriesToMove.MoveToPanel(chartPanel); if ((seriesToMove._seriesType != SeriesTypeEnum.stCandleChart && seriesToMove._seriesType != SeriesTypeEnum.stStockBarChart) && seriesToMove._seriesType != SeriesTypeEnum.stStockBarChartHLC) { _chartX.FireSeriesMoved(seriesToMove, _series.Count == 0 ? -1 : Index, chartPanel.Index); _chartX.UpdateByTimer(); return; } //series is a part from (O)|HLC group, move the others too Series seriesRelated; if (seriesToMove.OHLCType != SeriesTypeOHLC.Open && (seriesRelated = GetSeriesOHLCV(seriesToMove, SeriesTypeOHLC.Open)) != null) { seriesRelated.Painted = false; seriesRelated.MoveToPanel(chartPanel); } if (seriesToMove.OHLCType != SeriesTypeOHLC.High && (seriesRelated = GetSeriesOHLCV(seriesToMove, SeriesTypeOHLC.High)) != null) { seriesRelated.Painted = false; seriesRelated.MoveToPanel(chartPanel); } if (seriesToMove.OHLCType != SeriesTypeOHLC.Low && (seriesRelated = GetSeriesOHLCV(seriesToMove, SeriesTypeOHLC.Low)) != null) { seriesRelated.Painted = false; seriesRelated.MoveToPanel(chartPanel); } if (seriesToMove.OHLCType != SeriesTypeOHLC.Close && (seriesRelated = GetSeriesOHLCV(seriesToMove, SeriesTypeOHLC.Close)) != null) { seriesRelated.Painted = false; seriesRelated.MoveToPanel(chartPanel); } _chartX.FireSeriesMoved(seriesToMove, _series.Count == 0 ? -1 : Index, chartPanel.Index); _chartX.UpdateByTimer(); }
/// <summary> /// Constructor /// </summary> /// <param name="name">Unique series name. </param> /// <param name="seriesType">Series Type</param> /// <param name="seriesTypeOHLC">Series OHLC type</param> /// <param name="chartPanel">Reference to a chart panel where it will be placed.</param> public Standard(string name, SeriesTypeEnum seriesType, SeriesTypeOHLC seriesTypeOHLC, ChartPanel chartPanel) : base(name, seriesType, seriesTypeOHLC, chartPanel) { Init(); }
internal Stock(string name, SeriesTypeEnum seriesType, SeriesTypeOHLC seriesTypeOHLC, ChartPanel chartPanel) : base(name, seriesType, seriesTypeOHLC, chartPanel) { Init(); _chartPanel._chartX.ChartReseted += ChartX_OnChartReseted; _priceStyleStock = null; }
public ChartPanelInfoPanelItemY(ChartPanel chartPanel) { ChartPanelOwner = chartPanel; }
/// <summary> /// Initializes a new instance of the <see cref="ChartPanelPaintEventArgs"/> class. /// </summary> /// <param name="chartPanel">Reference to chart panel</param> public ChartPanelPaintEventArgs(ChartPanel chartPanel) { ChartPanel = chartPanel; }
internal void AddMinimizedPanel(ChartPanel panel) { _panelsBar.AddPanel(panel); SetPanelsBarVisibility(); }