private SparklineEdit CreateSparkline() { // Create a Sparkline editor and set its dock style. SparklineEdit sparkline = new SparklineEdit(); sparkline.Dock = DockStyle.Fill; sparkline.EditValue = CreateData(); // Create an Area view and assign it to the sparkline. AreaSparklineView view = new AreaSparklineView(); sparkline.Properties.View = view; // Customize area appearance. view.Color = Color.Aqua; view.AreaOpacity = 50; // Show markerks. view.HighlightStartPoint = true; view.HighlightEndPoint = true; view.HighlightMaxPoint = true; view.HighlightMinPoint = true; view.HighlightNegativePoints = true; view.SetSizeForAllMarkers(10); return(sparkline); }
void StockWorkspacesUC_Load(object sender, EventArgs e) { if (StockMarketView.defaultViewModel == null) { return; } StockMarketView.defaultViewModel.CurrentPriceIndexChanged += defaultViewModel_CurrentPriceIndexChanged; StockMarketView.defaultViewModel.PropertyChanged += defaultViewModel_PropertyChanged; //watchList watchListGridView.OptionsBehavior.AutoPopulateColumns = false; watchListGridView.OptionsBehavior.CacheValuesOnRowUpdating = CacheRowValuesMode.Disabled; watchListGrid.MainView.DataController.AllowIEnumerableDetails = false; watchListGridView.FocusRectStyle = XtraGrid.Views.Grid.DrawFocusRectStyle.None; watchListGrid.DataSource = StockMarketView.defaultViewModel.WatchListBindingData; GridColumn col = watchListGridView.Columns.Add(); col.FieldName = "CompanyName"; col.Caption = "Symbol"; col.Visible = true; col = watchListGridView.Columns.Add(); col.FieldName = "Price"; col.Caption = "Last Price"; //col.ColumnEdit = new ArrowButtonRepositoryItem(); col.DisplayFormat.FormatType = FormatType.Numeric; col.DisplayFormat.FormatString = "c"; col.Visible = true; col = watchListGridView.Columns.Add(); col.FieldName = "Volume"; col.DisplayFormat.FormatType = FormatType.Numeric; col.DisplayFormat.FormatString = "n0"; col.Visible = true; col = watchListGridView.Columns.Add(); col.FieldName = "Volume Dynamics"; RepositoryItemSparklineEdit rise = new RepositoryItemSparklineEdit(); col.ColumnEdit = rise; col.UnboundType = Data.UnboundColumnType.Object; AreaSparklineView view = new AreaSparklineView(); view.HighlightMaxPoint = true; view.HighlightMinPoint = true; rise.View = view; col.Visible = true; col = watchListGridView.Columns.Add(); col.FieldName = "Rise"; col.Name = "Rise"; col.Visible = false; //col = watchListGridView.Columns.Add(); //col.FieldName = "TotalRise"; //col.Name = "TotalRise"; //col.Visible = false; //FormatConditionRuleIconSet val = new FormatConditionIconSetPositiveNegativeTriangles() { RangeDescription = "0, >0" }; //watchListGridView.FormatRules.Add(new GridFormatRule() { Rule = val, Column = watchListGridView.Columns["Rise"], ColumnApplyTo=watchListGridView.Columns[1]}); var rule = watchListGridView.FormatRules.AddIconSetRule(watchListGridView.Columns["Rise"], new FormatConditionIconSetPositiveNegativeTriangles() { RangeDescription = "<0, 0, >0" }); rule.ColumnApplyTo = watchListGridView.Columns[1]; rule.Enabled = true; watchListGridView.BestFitColumns(); watchListGridView.FocusedRowChanged += new XtraGrid.Views.Base.FocusedRowChangedEventHandler(watchListGridView_FocusedRowChanged); //watchListGridView.CustomDrawCell += watchListGridView_CustomDrawCell; watchListGridView.CustomUnboundColumnData += watchListGridView_CustomUnboundColumnData; //chart stockChartUC.stockChart.Series["Price"].DataSource = StockMarketView.defaultViewModel.StockChartBindingData; stockChartUC.stockChart.Series["Price"].ArgumentDataMember = "Date"; stockChartUC.stockChart.Series["Price"].ValueDataMembers.AddRange(new string[] { "Low", "High", "Open", "Close" }); stockChartUC.stockChart.Series["Volume"].DataSource = StockMarketView.defaultViewModel.StockChartBindingData; stockChartUC.stockChart.Series["Volume"].ArgumentDataMember = "Date"; stockChartUC.stockChart.Series["Volume"].ValueDataMembers.AddRange(new string[] { "Volume" }); //volumeChart volumeChart.Series[0].DataSource = StockMarketView.defaultViewModel.VolumeChartBindingData; volumeChart.Series[0].ArgumentDataMember = "CompanyName"; volumeChart.Series[0].ToolTipPointPattern = "Argument: {A}
Value: {V}"; volumeChart.Series[0].ValueDataMembers.AddRange(new string[] { "Volume" }); //transationsGrid transactionGridView.OptionsBehavior.AutoPopulateColumns = false; transactionGrid.DataSource = StockMarketView.defaultViewModel.TransactionGridBindingData; var fceAsk = new FormatConditionRuleExpression() { Expression = "Ask > 0", PredefinedName = "Red Fill" }; transactionGridView.FormatRules.AddRule(new GridFormatRule() { ApplyToRow = true, Rule = fceAsk }); var fceBid = new FormatConditionRuleExpression() { Expression = "Bid > 0", PredefinedName = "Green Fill" }; transactionGridView.FormatRules.AddRule(new GridFormatRule() { ApplyToRow = true, Rule = fceBid }); StockMarketView.defaultViewModel.WatchListChanged += defaultViewModel_WatchListChanged; helpBarItemButton.ImageOptions.SvgImage = SvgResources.GetSvgImage("Help"); bbiSwatches.ImageOptions.SvgImage = SvgResources.GetSvgImage("Swatches"); bsiConnectedStatus.ImageOptions.SvgImage = SvgResources.GetSvgImage("Connected"); }