This question is locked. New answers and comments are not allowed.
Hi,
I am trying to display purchase prices of a product over time. I cannot show the specific date these purchase have been made so on the chart I am formating the date into a month. Everything works prefect except when the chart is expanded the month is repeated.
This is what I am using to render the chart.
Attached is what I am getting in the chart. I understand why I am getting these results in the chart. But I can't figure out how to only show one month.
Thanks,
Justin
I am trying to display purchase prices of a product over time. I cannot show the specific date these purchase have been made so on the chart I am formating the date into a month. Everything works prefect except when the chart is expanded the month is repeated.
This is what I am using to render the chart.
/// <summary> /// Creates a DataSeries object with the brush and label provided. /// </summary> /// <param name="brush">Color of the Series</param> /// <param name="legendLabel">Text for the legend label</param> /// <returns></returns> private DataSeries CreateDataSeries(SolidColorBrush brush, string legendLabel) { DataSeries dataSeries = new DataSeries(); dataSeries.Definition = new BarSeriesDefinition(); dataSeries.Definition.ShowItemLabels = false; dataSeries.Definition.ShowItemToolTips = true; dataSeries.Definition.Appearance.Fill = brush; dataSeries.LegendLabel = legendLabel; dataSeries.Definition.InteractivitySettings.HoverScope = InteractivityScope.Series; dataSeries.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Item; return dataSeries; } #region IChart Members public void Render() { PgReports.PricePointReportItems chartItems = this.DataSource as PgReports.PricePointReportItems; ChartHelper.ClearChart(this.Chart); this.Chart.DefaultView.ChartArea.EnableAnimations = true; this.Chart.DefaultView.ChartArea.NoDataString = "No Data"; this.Chart.DefaultView.ChartArea.AxisX.IsDateTime = true; this.Chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MM/yyyy"; this.Chart.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "C2"; this.Chart.DefaultView.ChartArea.AxisY.Title = "Price Paid ($)"; ChartHelper.SetChartLegend(this.Chart.DefaultView.ChartLegend); ChartHelper.SetChartTitle(this.Chart.DefaultView.ChartTitle, "Purchase Analysis"); DataSeries primaryMemberDataSeries = this.CreateDataSeries(StyleHelper.Brushes.PrimaryMember(), "Primary Member"); DataSeries healthSystemMembersDataSeries = this.CreateDataSeries(StyleHelper.Brushes.HealthSystemMembers(), "Health System Members"); DataSeries otherMemberDataSeries = this.CreateDataSeries(StyleHelper.Brushes.OtherMembers(), "Other Members"); DataSeries selectedMemberDataSeries = this.CreateDataSeries(StyleHelper.Brushes.SelectedMember(), "Selected Member"); foreach (PgReports.PricePointReportItem pricePoint in chartItems) { DataPoint dataPoint = new DataPoint(pricePoint.PurchaseDate.Value); dataPoint.YValue = pricePoint.PricePerUOM.Value; dataPoint.Tooltip = string.Concat("Member ID: ", pricePoint.MemberKey, " ", pricePoint.PricePerUOM.Value.ToString("C2")); if (selectedMemberId.HasValue && selectedMemberId.Value == pricePoint.MemberKey.Value) selectedMemberDataSeries.Add(dataPoint); else if (pricePoint.MemberKey.Value == ((IMember)(App.Current as App).UserProfile.PrimaryMember).MemberId.ToInt()) primaryMemberDataSeries.Add(dataPoint); else if ((from m in (App.Current as App).UserProfile.HeathSystemMembers.Cast<IMember>() where m.MemberId.ToInt() == pricePoint.MemberKey.Value select m).Count() == 1) healthSystemMembersDataSeries.Add(dataPoint); else otherMemberDataSeries.Add(dataPoint); } if (chartItems.Count > 0) { CustomGridLine customGridLine = new CustomGridLine(); customGridLine.YIntercept = chartItems.Average(p => p.PricePerUOM.Value); customGridLine.Stroke = StyleHelper.Brushes.SelectedMember(); customGridLine.StrokeThickness = 3; this.Chart.DefaultView.ChartArea.Annotations.Add(customGridLine); } this.EndWaiting(); this.Chart.DefaultView.ChartArea.DataSeries.Add(primaryMemberDataSeries); this.Chart.DefaultView.ChartArea.DataSeries.Add(healthSystemMembersDataSeries); if (selectedMemberId.HasValue) this.Chart.DefaultView.ChartArea.DataSeries.Add(selectedMemberDataSeries); this.Chart.DefaultView.ChartArea.DataSeries.Add(otherMemberDataSeries); } Attached is what I am getting in the chart. I understand why I am getting these results in the chart. But I can't figure out how to only show one month.
Thanks,
Justin