public AxisPointDateTime(Chart xChart, DateTimeAxis xAxis, Point xPoint, DateTime xMin, DateTime xMax) : base(xChart, xAxis, xPoint) { Min = xMin; Max = xMax; Range = xMax - xMin; Axis = xAxis; MouseAxisValueAbsolute = xMin.AddMinutes(MouseAxisValueRelative * Range.TotalMinutes); } // constructor
/// <summary> /// Create a ISeriesHost with a DateTime Axis and a TimeSpan so it can pick the appropriate interval. /// </summary> /// <param name="timeSpan">Time span for the data.</param> /// <returns>ISeriesHost for testing.</returns> private static Chart CreateDateTimeAxisWithIntervalChart(TimeSpan timeSpan) { Chart chart = new Chart(); DateTimeAxis dateTimeAxis = new DateTimeAxis(); dateTimeAxis.Orientation = AxisOrientation.X; chart.Axes.Add(dateTimeAxis); DataPointSeries series = new LineSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); DateTime start = new DateTime(2008, 1, 1); series.ItemsSource = new DateTime[] { start, start + timeSpan }; chart.Series.Add(series); return chart; }
public void UpdateAxis() { try { const int MAX_CNT = 80; int cnt = 0; cnt = m_plaza2Connector.GUIBox.GUICandleBox[m_isin][tf][dt].Count - 1; DateTime maxDate = m_plaza2Connector.GUIBox.GUICandleBox[m_isin][tf][dt][cnt].Date; DateTime minDate0 = m_plaza2Connector.GUIBox.GUICandleBox[m_isin][tf][dt][0].Date; DateTime minDate = GetMinDate(maxDate, dictIntervalTypes[tf], MAX_CNT * dictIntervals[tf]); //Plaza2Connector.GUIBox.GUICandleBox[isin][tf][dt][first].Date; minDate = CUtilTime.MaxDate(minDate0, minDate); minAbs = m_plaza2Connector.GUIBox.GUICandleBox[m_isin][tf][dt].GetMinimumFromDate(minDate); maxAbs = m_plaza2Connector.GUIBox.GUICandleBox[m_isin][tf][dt].GetMaximumFromDate(minDate); CreateOrUpdateAxis(); System.Windows.Controls.DataVisualization.Charting.DateTimeAxis axis_X = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)Chart.SeriesHost.Axes[0]); CorrectMinMax(dictIntervalTypes[tf], dictIntervals [tf], ref minDate, ref maxDate); axis_X.Minimum = minDate; axis_X.Maximum = maxDate; axis_X.IntervalType = dictIntervalTypes[tf]; axis_X.Interval = dictIntervals[tf]; } catch (Exception e) { m_plaza2Connector.Alarmer.Error("UpdateAxis", e); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 14 "..\..\OnlyCharts - 복사본.xaml" ((System.Windows.Controls.Grid)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Grid_KeyDown); #line default #line hidden return; case 2: this.UL_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 3: this.xAxisUL = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 4: this.UR_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 5: this.xAxisUR = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 6: this.DL_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 7: this.xAxisDL = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 8: this.DR_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 9: this.xAxisDR = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; } this._contentLoaded = true; }
private static void SetupDateTimeAxis(DateTimeAxis dateTimeAxis, DateTime startDate, DateTime endDate) { dateTimeAxis.Minimum = startDate; dateTimeAxis.Maximum = endDate; switch (ApplicationSettings.DefaultGraphMode) { case ApplicationSettings.GraphMode.Week: dateTimeAxis.IntervalType = DateTimeIntervalType.Days; dateTimeAxis.Interval = 1; break; case ApplicationSettings.GraphMode.Month: dateTimeAxis.IntervalType = DateTimeIntervalType.Days; dateTimeAxis.Interval = 6; break; case ApplicationSettings.GraphMode.Year: dateTimeAxis.IntervalType = DateTimeIntervalType.Months; dateTimeAxis.Interval = 2; break; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 13 "..\..\LRChart.xaml" ((System.Windows.Controls.Grid)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Grid_KeyDown); #line default #line hidden return; case 2: this.LR_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 3: this.xAxis = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 4: #line 81 "..\..\LRChart.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_pause_Click); #line default #line hidden return; case 5: #line 82 "..\..\LRChart.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_restart_Click); #line default #line hidden return; } this._contentLoaded = true; }
private void ChildWindow_Loaded(object sender, RoutedEventArgs e) { Size(); service.GetStatisticsDataCompleted += new EventHandler<GetStatisticsDataCompletedEventArgs>(service_GetStatisticsDataCompleted); //根据起始时间和结束时间自动设置时间粒度 SetTimeSpan(); //初始化x轴 DateTimeAxis dateAxis = new DateTimeAxis() { Orientation = AxisOrientation.X, Title = TimePoint, FontStyle = FontStyles.Normal, FontSize = 10f, ShowGridLines = true, }; dateAxis.GridLineStyle = new Style(typeof(Line)); dateAxis.GridLineStyle.Setters.Add(new Setter(Line.StrokeThicknessProperty, 1)); dateAxis.GridLineStyle.Setters.Add(new Setter(Line.StrokeProperty, "LightGray")); //初始化y轴 LinearAxis valueAxis = new LinearAxis() { Orientation = AxisOrientation.Y, Title = DataVolume, FontStyle = FontStyles.Normal, FontSize = 12f, ShowGridLines = true, }; valueAxis.GridLineStyle = new Style(typeof(Line)); valueAxis.GridLineStyle.Setters.Add(new Setter(Line.StrokeProperty, "LightGray")); valueAxis.GridLineStyle.Setters.Add(new Setter(Line.StrokeThicknessProperty, 1)); Chart.Axes.Clear(); Chart.Axes.Add(dateAxis); Chart.Axes.Add(valueAxis); //加载数据 ShowData(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 14 "..\..\..\OnlyCharts.xaml" ((System.Windows.Controls.Grid)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Grid_KeyDown); #line default #line hidden return; case 2: this.UL_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 3: this.xAxisUL = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 4: this.UR_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 5: this.xAxisUR = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 6: this.DL_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 7: this.xAxisDL = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 8: this.DR_Chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 9: this.xAxisDR = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 10: this.pauseBtn = ((System.Windows.Controls.Button)(target)); #line 243 "..\..\..\OnlyCharts.xaml" this.pauseBtn.Click += new System.Windows.RoutedEventHandler(this.Button_pause_Click); #line default #line hidden return; case 11: this.restartBtn = ((System.Windows.Controls.Button)(target)); #line 244 "..\..\..\OnlyCharts.xaml" this.restartBtn.Click += new System.Windows.RoutedEventHandler(this.Button_restart_Click); #line default #line hidden return; case 12: this.resetBtn = ((System.Windows.Controls.Button)(target)); #line 245 "..\..\..\OnlyCharts.xaml" this.resetBtn.Click += new System.Windows.RoutedEventHandler(this.Button_reset_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.gridMain = ((System.Windows.Controls.Grid)(target)); return; case 2: this.gridSK1 = ((System.Windows.Controls.Grid)(target)); return; case 3: this.spTextBlock = ((System.Windows.Controls.StackPanel)(target)); return; case 4: this.imgSK = ((System.Windows.Controls.Image)(target)); return; case 5: this.SKHistory = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 6: this.YAxisSK1 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 7: this.XAxisSK1 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 8: this.YLHistory = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 9: this.YAxisYL1 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 10: this.XAxisYL1 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 11: this.gridSK2 = ((System.Windows.Controls.Grid)(target)); return; case 12: this.spTextBlockSK2 = ((System.Windows.Controls.StackPanel)(target)); return; case 13: this.imgSK2 = ((System.Windows.Controls.Image)(target)); return; case 14: this.SK2History = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 15: this.YAxisSK2 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 16: this.XAxisSK2 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 17: this.YL2History = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 18: this.YAxisYL2 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 19: this.XAxisYL2 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 20: this.gridSK3 = ((System.Windows.Controls.Grid)(target)); return; case 21: this.spTextBlockSK3 = ((System.Windows.Controls.StackPanel)(target)); return; case 22: this.imgSK3 = ((System.Windows.Controls.Image)(target)); return; case 23: this.SK3History = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 24: this.YAxisSK3 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 25: this.XAxisSK3 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; case 26: this.YL3History = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 27: this.YAxisYL3 = ((System.Windows.Controls.DataVisualization.Charting.LinearAxis)(target)); return; case 28: this.XAxisYL3 = ((System.Windows.Controls.DataVisualization.Charting.DateTimeAxis)(target)); return; } this._contentLoaded = true; }
/// <summary> /// IntervalProperty property changed handler. /// </summary> /// <param name="d">DateTimeAxis2 that changed its Interval.</param> /// <param name="e">Event arguments.</param> private static void OnIntervalPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DateTimeAxis source = (DateTimeAxis)d; source.OnIntervalPropertyChanged(); }
public void DateTimeAxisLabelHonorsStringFormat() { Chart chart = new Chart(); string dateTimeFormat = "|{0:MM,dd}|"; DateTimeAxis axis = new DateTimeAxis { Orientation = AxisOrientation.X }; Style labelStyle = new Style(typeof(DateTimeAxisLabel)); labelStyle.Setters.Add(new Setter(DateTimeAxisLabel.StringFormatProperty, dateTimeFormat)); axis.AxisLabelStyle = labelStyle; chart.Axes.Add(axis); ScatterSeries series = new ScatterSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); DateTime[] itemsSource = new DateTime[] { new DateTime(2009, 1, 23) }; series.ItemsSource = itemsSource; chart.Series.Add(series); TestAsync( chart, () => { AxisLabel label = ChartTestUtilities.GetAxisLabels(axis).First(); Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, dateTimeFormat, label.DataContext), label.FormattedContent); }); }
public void DateTimeAxisWorksAsIndependentAxis() { Chart chart = new Chart(); DataPointSeries series = DefaultSeriesToTest; series.DependentValueBinding = new Binding("Value"); series.IndependentValueBinding = new Binding("Key"); series.ItemsSource = new KeyValuePair<DateTime, int>[] { new KeyValuePair<DateTime, int>(new DateTime(2009, 1, 1), 1), new KeyValuePair<DateTime, int>(new DateTime(2009, 1, 2), 3), new KeyValuePair<DateTime, int>(new DateTime(2009, 1, 3), 4), }; var axis = new DateTimeAxis(); axis.Interval = 1; axis.IntervalType = DateTimeIntervalType.Days; if (series is BarSeries) { axis.Orientation = AxisOrientation.Y; ((BarSeries)series).IndependentAxis = axis; } else { axis.Orientation = AxisOrientation.X; ((ColumnSeries)series).IndependentAxis = axis; } chart.Series.Add(series); TestAsync( chart, () => Assert.AreEqual(3, ChartTestUtilities.GetDataPointsForSeries(series).Count)); }
public void AxisInAxisCollection() { Chart chart = new Chart(); DateTimeAxis dateTimeAxis = new DateTimeAxis(); dateTimeAxis.Orientation = AxisOrientation.X; dateTimeAxis.IntervalType = DateTimeIntervalType.Days; dateTimeAxis.Interval = 1; chart.Axes.Add(dateTimeAxis); DataPointSeries series = new LineSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); series.ItemsSource = new DateTime[] { new DateTime(2008, 1, 1), new DateTime(2008, 1, 2) }; chart.Series.Add(series); TestAsync( chart, () => chart.UpdateLayout()); }
public void UpdateGraph(CalculationOptionsMage calculationOptions) { DisplayCalculations calculations = calculationOptions.Calculations; Chart.Series.Clear(); Chart.Axes.Clear(); Chart.Text = null; if (calculationOptions.SequenceReconstruction == null) { Chart.Text = "Sequence reconstruction data is not available."; } else { List<EffectCooldown> cooldownList = calculationOptions.Calculations.CooldownList; /*brushSubPoints = new Brush[cooldownList.Count]; colorSubPointsA = new Color[cooldownList.Count]; colorSubPointsB = new Color[cooldownList.Count]; for (int i = 0; i < cooldownList.Count; i++) { Color baseColor = cooldownList[i].Color; brushSubPoints[i] = new SolidBrush(Color.FromArgb(baseColor.R / 2, baseColor.G / 2, baseColor.B / 2)); colorSubPointsA[i] = Color.FromArgb(baseColor.A / 2, baseColor.R / 2, baseColor.G / 2, baseColor.B / 2); colorSubPointsB[i] = Color.FromArgb(baseColor.A / 2, baseColor); } StringFormat formatSubPoint = new StringFormat(); formatSubPoint.Alignment = StringAlignment.Center; formatSubPoint.LineAlignment = StringAlignment.Center; int maxWidth = 1; for (int i = 0; i < cooldownList.Count; i++) { string subPointName = cooldownList[i].Name; int widthSubPoint = (int)Math.Ceiling(g.MeasureString(subPointName, fontLegend).Width + 2f); if (widthSubPoint > maxWidth) maxWidth = widthSubPoint; } for (int i = 0; i < cooldownList.Count; i++) { string cooldownName = cooldownList[i].Name; rectSubPoint = new Rectangle(2, legendY, maxWidth, 16); blendSubPoint = new System.Drawing.Drawing2D.ColorBlend(3); blendSubPoint.Colors = new Color[] { colorSubPointsA[i], colorSubPointsB[i], colorSubPointsA[i] }; blendSubPoint.Positions = new float[] { 0f, 0.5f, 1f }; brushSubPointFill = new System.Drawing.Drawing2D.LinearGradientBrush(rectSubPoint, colorSubPointsA[i], colorSubPointsB[i], 67f); brushSubPointFill.InterpolationColors = blendSubPoint; g.FillRectangle(brushSubPointFill, rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawString(cooldownName, fontLegend, brushSubPoints[i], rectSubPoint, formatSubPoint); legendY += 16; }*/ if (calculationOptions.AdviseAdvancedSolver) { Chart.Text = "Sequence Reconstruction was not fully successful, it is recommended that you enable more options in advanced solver (segment cooldowns, integral mana consumables, advanced constraints options)!"; } /*g.DrawLine(Pens.Aqua, new Point(maxWidth + 40, 10), new Point(maxWidth + 80, 10)); g.DrawString("Mana", fontLegend, Brushes.Black, new Point(maxWidth + 90, 2)); g.DrawLine(Pens.Red, new Point(maxWidth + 40, 26), new Point(maxWidth + 80, 26)); g.DrawString("Dps", fontLegend, Brushes.Black, new Point(maxWidth + 90, 18));*/ List<SequenceItem> sequence = calculationOptions.SequenceReconstruction.sequence; List<TimeData> manaList = new List<TimeData>(); float mana = calculations.StartingMana; int gemCount = 0; float time = 0; Color manaFill = Color.FromArgb(50, 0, 0, 255); float maxMana = calculations.BaseStats.Mana; float maxDps = 100; DateTime baseTime = new DateTime(2000, 1, 1, 0, 0, 0); manaList.Add(new TimeData() { Time = baseTime, Value = mana }); for (int i = 0; i < sequence.Count; i++) { int index = sequence[i].Index; VariableType type = sequence[i].VariableType; float duration = (float)sequence[i].Duration; Cycle cycle = sequence[i].Cycle; CastingState state = sequence[i].CastingState; if (cycle != null) { float dps = (float)cycle.GetDamagePerSecond(state.ManaAdeptBonus, 1); if (dps > maxDps) maxDps = dps; } float mps = (float)sequence[i].Mps; if (sequence[i].IsManaPotionOrGem) { float value = duration; duration = 0; if (sequence[i].VariableType == VariableType.ManaGem) { mana += (float)((1 + calculations.BaseStats.BonusManaGem) * calculations.ManaGemValue * value); gemCount++; } else if (sequence[i].VariableType == VariableType.ManaPotion) { mana += (float)((1 + calculations.BaseStats.BonusManaPotionEffectMultiplier) * calculations.ManaPotionValue * value); } if (mana < 0) mana = 0; if (mana > maxMana) { mana = maxMana; } manaList.Add(new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time) + TimeSpan.FromTicks(1), Value = mana }); } else { /*if (sequence[i].IsEvocation) { switch (sequence[i].VariableType) { case VariableType.Evocation: mps = -(float)calculationOptions.Calculations.EvocationRegen; break; case VariableType.EvocationIV: mps = -(float)calculationOptions.Calculations.EvocationRegenIV; break; case VariableType.EvocationHero: mps = -(float)calculationOptions.Calculations.EvocationRegenHero; break; case VariableType.EvocationIVHero: mps = -(float)calculationOptions.Calculations.EvocationRegenIVHero; break; } }*/ float partTime = duration; if (mana - mps * duration < 0) partTime = mana / mps; else if (mana - mps * duration > maxMana) partTime = (mana - maxMana) / mps; mana -= mps * duration; if (mana < 0) mana = 0; if (mana > maxMana) { mana = maxMana; } manaList.Add(new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time + partTime), Value = mana }); if (partTime < duration) { manaList.Add(new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time + duration), Value = mana }); } } time += duration; } Style dateTimeAxisLabelStyle = new Style(typeof(DateTimeAxisLabel)); dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.MinutesIntervalStringFormatProperty, "{0:m:ss}")); dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.SecondsIntervalStringFormatProperty, "{0:m:ss}")); DateTimeAxis timeAxis = new DateTimeAxis() { //Title = "Time", Minimum = baseTime, Maximum = baseTime + TimeSpan.FromSeconds(calculationOptions.FightDuration), IntervalType = DateTimeIntervalType.Seconds, AxisLabelStyle = dateTimeAxisLabelStyle, Orientation = AxisOrientation.X, ShowGridLines = true, Location = AxisLocation.Top, }; Style hiddenCategoryLabelStyle = new Style(typeof(AxisLabel)); hiddenCategoryLabelStyle.Setters.Add(new Setter(NumericAxisLabel.VisibilityProperty, Visibility.Collapsed)); CategoryAxis categoryAxis = new CategoryAxis() { AxisLabelStyle = hiddenCategoryLabelStyle, Orientation = AxisOrientation.Y, MajorTickMarkStyle = null, }; int barCount = 0; for (int cooldown = 0; cooldown < cooldownList.Count; cooldown++) { List<TimeIntervalData> data = new List<TimeIntervalData>(); //blendSubPoint = new System.Drawing.Drawing2D.ColorBlend(3); //blendSubPoint.Colors = new Color[] { colorSubPointsA[cooldown], colorSubPointsB[cooldown], colorSubPointsA[cooldown] }; //blendSubPoint.Positions = new float[] { 0f, 0.5f, 1f }; bool on = false; float timeOn = 0.0f; time = 0; for (int i = 0; i < sequence.Count; i++) { float duration = (float)sequence[i].Duration; if (sequence[i].IsManaPotionOrGem) duration = 0; if (on && !sequence[i].CastingState.EffectsActive(cooldownList[cooldown]) && !sequence[i].IsManaPotionOrGem) { on = false; if (time > timeOn) { data.Add(new TimeIntervalData() { Start = baseTime + TimeSpan.FromSeconds(timeOn), End = baseTime + TimeSpan.FromSeconds(time), Category = cooldownList[cooldown].Name }); } } else if (!on && sequence[i].CastingState.EffectsActive(cooldownList[cooldown])) { on = true; timeOn = time; } time += duration; } if (on) { if (time - timeOn > 0) { data.Add(new TimeIntervalData() { Start = baseTime + TimeSpan.FromSeconds(timeOn), End = baseTime + TimeSpan.FromSeconds(time), Category = cooldownList[cooldown].Name }); } } if (data.Count > 0) { barCount++; Style timeIntervalStyle = new Style(typeof(TimeIntervalDataPoint)); timeIntervalStyle.Setters.Add(new Setter(TimeIntervalDataPoint.BackgroundProperty, new SolidColorBrush(cooldownList[cooldown].Color))); Chart.Series.Add(new TimeIntervalSeries() { Title = cooldownList[cooldown].Name, ItemsSource = data, IndependentValuePath = "Category", DependentValuePath = "End", StartTimePath = "Start", EndTimePath = "End", DataPointStyle = timeIntervalStyle, DependentRangeAxis = timeAxis, IndependentAxis = categoryAxis }); } } if (calculationOptions.DisplaySegmentCooldowns && calculationOptions.BossHandler) { foreach (var buffState in calculationOptions.Character.BossOptions.BuffStates) { if (buffState.Chance > 0 && buffState.Stats.BonusDamageMultiplier > 0) { List<TimeIntervalData> data = new List<TimeIntervalData>(); foreach (var phase in buffState.PhaseTimes) { data.Add(new TimeIntervalData() { Start = baseTime + TimeSpan.FromSeconds(phase.Value[0]), End = baseTime + TimeSpan.FromSeconds(phase.Value[1]), Category = buffState.Name }); } if (data.Count > 0) { barCount++; Style timeIntervalStyle = new Style(typeof(TimeIntervalDataPoint)); timeIntervalStyle.Setters.Add(new Setter(TimeIntervalDataPoint.BackgroundProperty, new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)))); Chart.Series.Add(new TimeIntervalSeries() { Title = buffState.Name, ItemsSource = data, IndependentValuePath = "Category", DependentValuePath = "End", StartTimePath = "Start", EndTimePath = "End", DataPointStyle = timeIntervalStyle, DependentRangeAxis = timeAxis, IndependentAxis = categoryAxis }); } } } } Style hiddenNumericLabelStyle = new Style(typeof(NumericAxisLabel)); hiddenNumericLabelStyle.Setters.Add(new Setter(NumericAxisLabel.VisibilityProperty, Visibility.Collapsed)); Chart.Series.Add(new AreaSeries() { Title = "Mana", ItemsSource = manaList, IndependentValuePath = "Time", DependentValuePath = "Value", DataPointStyle = (Style)Resources["ManaStyle"], Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0xFF)), DependentRangeAxis = new OffsetLinearAxis() { Minimum = 0, Offset = barCount * 10.0, Orientation = AxisOrientation.Y, AxisLabelStyle = hiddenNumericLabelStyle, MajorTickMarkStyle = null, MinorTickMarkStyle = null, }, IndependentAxis = timeAxis, LegendItemStyle = null, }); maxDps *= 1.1f; List<TimeData> list = new List<TimeData>(); time = 0.0f; for (int i = 0; i < sequence.Count; i++) { int index = sequence[i].Index; VariableType type = sequence[i].VariableType; float duration = (float)sequence[i].Duration; Cycle cycle = sequence[i].Cycle; CastingState state = sequence[i].CastingState; float mps = (float)sequence[i].Mps; if (sequence[i].IsManaPotionOrGem) duration = 0; float dps = 0; if (cycle != null) { dps = (float)cycle.DamagePerSecond; } if (duration > 0) { if (calculations.ManaAdeptBonus > 0) { for (int t = 1; t < 10; t++) { DateTime timet = baseTime + TimeSpan.FromSeconds(time + 0.1f * t * duration); if (cycle != null) { dps = (float)cycle.GetDamagePerSecond(calculations.ManaAdeptBonus, GetManaAtTime(manaList, timet) / maxMana); } // apply state multipliers if (calculationOptions.DisplaySegmentCooldowns) { dps *= calculationOptions.GetDamageMultiplier(time, time + duration); } list.Add(new TimeData() { Time = timet, Value = dps }); } } else { // apply state multipliers if (calculationOptions.DisplaySegmentCooldowns) { dps *= calculationOptions.GetDamageMultiplier(time, time + duration); } list.Add(new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time + 0.1f * duration), Value = dps }); list.Add(new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time + 0.9f * duration), Value = dps }); } } time += duration; } Chart.Series.Add(new LineSeries() { Title = "Dps", ItemsSource = list, IndependentValuePath = "Time", DependentValuePath = "Value", DataPointStyle = (Style)Resources["DpsStyle"], DependentRangeAxis = new OffsetLinearAxis() { Offset = barCount * 10.0, Minimum = 0, Orientation = AxisOrientation.Y, AxisLabelStyle = hiddenNumericLabelStyle, MajorTickMarkStyle = null, MinorTickMarkStyle = null, }, IndependentAxis = timeAxis, }); if (zeroLineCanvas == null) { zeroLineCanvas = new ZeroLineCanvas(categoryAxis); zeroLineCanvas.BarCount = barCount; } else { zeroLineCanvas.BarCount = barCount; zeroLineCanvas.Axis = categoryAxis; } ISeriesHost host = (ISeriesHost)Chart; if (!host.BackgroundElements.Contains(zeroLineCanvas)) { host.BackgroundElements.Add(zeroLineCanvas); } } }
public void ActualMinimumActualMaximumCorrect() { Chart chart = new Chart(); DateTimeAxis axis = new DateTimeAxis { Orientation = AxisOrientation.X, Minimum = new DateTime(2009, 1, 20), Maximum = new DateTime(2009, 1, 30) }; chart.Axes.Add(axis); ScatterSeries series = new ScatterSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); DateTime[] itemsSource = new DateTime[] { new DateTime(2009, 1, 23) }; series.ItemsSource = itemsSource; chart.Series.Add(series); TestAsync( chart, () => Assert.AreEqual(axis.Minimum, axis.ActualMinimum), () => Assert.AreEqual(axis.Maximum, axis.ActualMaximum)); }
public void OnDateRangeDefined(DateTime start, DateTime end, List<KeyValuePair<DateTime, int>> areaChartDataPoints) { if (end.Equals(DateTime.MinValue)) { return; } this.areaChartDataPoints = areaChartDataPoints; myMap.TimeExtent = new TimeExtent(start.AddHours(-1), end.AddHours(1)); slider.MinimumValue = myMap.TimeExtent.Start; slider.MaximumValue = myMap.TimeExtent.End; slider.Value = new TimeExtent(slider.MinimumValue, slider.MinimumValue.AddHours(2)); slider.Intervals = TimeSlider.CreateTimeStopsByTimeInterval(new TimeExtent(slider.MinimumValue, slider.MaximumValue), new TimeSpan(1, 0, 0, 0)); if (layerList.ClusterLayers.Count == 1) { DateTimeAxis axis = new DateTimeAxis(); axis.Orientation = AxisOrientation.X; axis.Visibility = Visibility.Hidden; axis.IntervalType = DateTimeIntervalType.Days; axis.FontSize = 0.1; areaSeries.IndependentAxis = axis; areaSeries.DependentValuePath = "Value"; areaSeries.IndependentValuePath = "Key"; areaSeries.ItemsSource = areaChartDataPoints; areaSeries.LegendItems.Clear(); } }
/// <summary> /// Generates value/value Series samples. /// </summary> /// <param name="panel">Panel to add the generated Charts to.</param> /// <param name="seriesConstructor">Function that returns a Series instance for each sample.</param> public static void GenerateDateTimeValueSeriesSamples(Panel panel, Func<Series> seriesConstructor) { Scenario[] scenarios = new Scenario[] { new Scenario { Title = "Value by Date", ItemsSource = _dynamicDateItemsSource, DependentValueBinding = new Binding("Second"), IndependentValueBinding = new Binding("First") }, }; Action<Chart> chartModifier = (chart) => { IAxis dateAxis = new DateTimeAxis { Orientation = AxisOrientation.X }; chart.Axes.Add(dateAxis); IAxis valueAxis = new LinearAxis { Orientation = AxisOrientation.Y, Minimum = 0, Maximum = 20, ShowGridLines = true }; chart.Axes.Add(valueAxis); }; GenerateSeriesSamples(panel, seriesConstructor, scenarios, chartModifier); }
public void InitializeComponent() { if (!this._contentLoaded) { this._contentLoaded = true; Application.LoadComponent(this, new Uri("/BEPB;component/MainPage.xaml", UriKind.Relative)); this.LayoutRoot = (Grid) base.FindName("LayoutRoot"); this.Actually = (Image) base.FindName("Actually"); this.Quality = (Image) base.FindName("Quality"); this.Forecast = (Image) base.FindName("Forecast"); this.Support = (Image) base.FindName("Support"); this.Mobile = (Image) base.FindName("Mobile"); this.busyIndicator = (BusyIndicator) base.FindName("busyIndicator"); this.map = (CMap) base.FindName("map"); this.epbMapTileLayer = (MapTileLayer) base.FindName("epbMapTileLayer"); this.MapMask = (MapLayer) base.FindName("MapMask"); this.Districts = (MapLayer) base.FindName("Districts"); this.CityCenterBorder2 = (MapPolygon) base.FindName("CityCenterBorder2"); this.HuaiRou = (MapPolygon) base.FindName("HuaiRou"); this.MiYun = (MapPolygon) base.FindName("MiYun"); this.YanQing = (MapPolygon) base.FindName("YanQing"); this.ChangPing = (MapPolygon) base.FindName("ChangPing"); this.PingGu = (MapPolygon) base.FindName("PingGu"); this.ShunYi = (MapPolygon) base.FindName("ShunYi"); this.MenTouGou = (MapPolygon) base.FindName("MenTouGou"); this.HaiDian = (MapPolygon) base.FindName("HaiDian"); this.ChaoYang = (MapPolygon) base.FindName("ChaoYang"); this.TongZhou = (MapPolygon) base.FindName("TongZhou"); this.ShiJingShan = (MapPolygon) base.FindName("ShiJingShan"); this.DongCheng = (MapPolygon) base.FindName("DongCheng"); this.XiCheng = (MapPolygon) base.FindName("XiCheng"); this.FangShan = (MapPolygon) base.FindName("FangShan"); this.FengTai = (MapPolygon) base.FindName("FengTai"); this.DaXing = (MapPolygon) base.FindName("DaXing"); this.DistrictsName = (MapLayer) base.FindName("DistrictsName"); this.东城区Name = (Pushpin) base.FindName("东城区Name"); this.西城区Name = (Pushpin) base.FindName("西城区Name"); this.朝阳区Name = (Pushpin) base.FindName("朝阳区Name"); this.丰台区Name = (Pushpin) base.FindName("丰台区Name"); this.石景山区Name = (Pushpin) base.FindName("石景山区Name"); this.海淀区Name = (Pushpin) base.FindName("海淀区Name"); this.门头沟区Name = (Pushpin) base.FindName("门头沟区Name"); this.房山区Name = (Pushpin) base.FindName("房山区Name"); this.通州区Name = (Pushpin) base.FindName("通州区Name"); this.顺义区Name = (Pushpin) base.FindName("顺义区Name"); this.昌平区Name = (Pushpin) base.FindName("昌平区Name"); this.大兴区Name = (Pushpin) base.FindName("大兴区Name"); this.怀柔区Name = (Pushpin) base.FindName("怀柔区Name"); this.平谷区Name = (Pushpin) base.FindName("平谷区Name"); this.密云县Name = (Pushpin) base.FindName("密云县Name"); this.延庆县Name = (Pushpin) base.FindName("延庆县Name"); this.Five = (MapLayer) base.FindName("Five"); this.NorthEastBorder = (MapPolygon) base.FindName("NorthEastBorder"); this.NorthWestBorder = (MapPolygon) base.FindName("NorthWestBorder"); this.SouthWestBorder = (MapPolygon) base.FindName("SouthWestBorder"); this.CityCenterBorder = (MapPolygon) base.FindName("CityCenterBorder"); this.SouthEastBorder = (MapPolygon) base.FindName("SouthEastBorder"); this.NorthEast = (MapPolygon) base.FindName("NorthEast"); this.NorthWest = (MapPolygon) base.FindName("NorthWest"); this.SouthWest = (MapPolygon) base.FindName("SouthWest"); this.CityCenter = (MapPolygon) base.FindName("CityCenter"); this.SouthEast = (MapPolygon) base.FindName("SouthEast"); this.NorthEastText = (Pushpin) base.FindName("NorthEastText"); this.NorthWestText = (Pushpin) base.FindName("NorthWestText"); this.CityCenterText = (Pushpin) base.FindName("CityCenterText"); this.SouthEastText = (Pushpin) base.FindName("SouthEastText"); this.SouthWestText = (Pushpin) base.FindName("SouthWestText"); this.MapStations = (MapLayer) base.FindName("MapStations"); this.NavigationCtrl = (BEPB.NavigationCtrl) base.FindName("NavigationCtrl"); this.btn_yx = (ToggleButton) base.FindName("btn_yx"); this.btn_dx = (ToggleButton) base.FindName("btn_dx"); this.btn_sl = (ToggleButton) base.FindName("btn_sl"); this.btnAlertMessage = (Button) base.FindName("btnAlertMessage"); this.wrwtl = (Image) base.FindName("wrwtl"); this.wrwtlGrid = (Grid) base.FindName("wrwtlGrid"); this.wrwtlTitle = (TextBlock) base.FindName("wrwtlTitle"); this.wrwtlRect1 = (Rectangle) base.FindName("wrwtlRect1"); this.wrwtlRect2 = (Rectangle) base.FindName("wrwtlRect2"); this.wrwtlRect3 = (Rectangle) base.FindName("wrwtlRect3"); this.wrwtlRect4 = (Rectangle) base.FindName("wrwtlRect4"); this.wrwtlRect5 = (Rectangle) base.FindName("wrwtlRect5"); this.wrwtlRect6 = (Rectangle) base.FindName("wrwtlRect6"); this.wrwtlData = (TextBlock) base.FindName("wrwtlData"); this.p_bottom_aqi = (Image) base.FindName("p_bottom_aqi"); this.p_bottom_aqiGrid = (StackPanel) base.FindName("p_bottom_aqiGrid"); this.aqiEllipse1 = (Ellipse) base.FindName("aqiEllipse1"); this.aqiEllipse2 = (Ellipse) base.FindName("aqiEllipse2"); this.aqiEllipse3 = (Ellipse) base.FindName("aqiEllipse3"); this.aqiEllipse4 = (Ellipse) base.FindName("aqiEllipse4"); this.aqiEllipse5 = (Ellipse) base.FindName("aqiEllipse5"); this.aqiEllipse6 = (Ellipse) base.FindName("aqiEllipse6"); this.p_aqi_detail = (Image) base.FindName("p_aqi_detail"); this.dgAQIDetailText = (DataGrid) base.FindName("dgAQIDetailText"); this.RenderImagesListBox = (ListBox) base.FindName("RenderImagesListBox"); this.LeftFrame = (Grid) base.FindName("LeftFrame"); this.Expand = (Storyboard) base.FindName("Expand"); this.LeftFrameExpandAnimation = (DoubleAnimation) base.FindName("LeftFrameExpandAnimation"); this.LeftFrameNewExpand = (Storyboard) base.FindName("LeftFrameNewExpand"); this.ForecastExpandAnimation = (DoubleAnimation) base.FindName("ForecastExpandAnimation"); this.ActuallyExpandAnimation = (DoubleAnimation) base.FindName("ActuallyExpandAnimation"); this.QualityExpandAnimation = (DoubleAnimation) base.FindName("QualityExpandAnimation"); this.ActuallyFrame_Old = (Grid) base.FindName("ActuallyFrame_Old"); this.Tab = (TabControl) base.FindName("Tab"); this.AQITabItem = (TabItem) base.FindName("AQITabItem"); this.AQITabItemGrid = (Grid) base.FindName("AQITabItemGrid"); this.dgAQI_Old = (DataGrid) base.FindName("dgAQI_Old"); this.WRWTabItem = (TabItem) base.FindName("WRWTabItem"); this.WRWTabItemGrid = (Grid) base.FindName("WRWTabItemGrid"); this.LeftFrameTopRectangle_Old = (Rectangle) base.FindName("LeftFrameTopRectangle_Old"); this.dgWRW_Old = (DataGrid) base.FindName("dgWRW_Old"); this.lbl_DateTime_Old = (Run) base.FindName("lbl_DateTime_Old"); this.wrwButtonsBorder_Old = (Border) base.FindName("wrwButtonsBorder_Old"); this.wrwButtons_Old = (Canvas) base.FindName("wrwButtons_Old"); this.PM25Storyboard_Old = (Storyboard) base.FindName("PM25Storyboard_Old"); this.PM10Storyboard_Old = (Storyboard) base.FindName("PM10Storyboard_Old"); this.SO2Storyboard_Old = (Storyboard) base.FindName("SO2Storyboard_Old"); this.NO2Storyboard_Old = (Storyboard) base.FindName("NO2Storyboard_Old"); this.O31Storyboard_Old = (Storyboard) base.FindName("O31Storyboard_Old"); this.COStoryboard_Old = (Storyboard) base.FindName("COStoryboard_Old"); this.wrw_pm25_Old = (ToggleButton) base.FindName("wrw_pm25_Old"); this.wrw_pm10_Old = (ToggleButton) base.FindName("wrw_pm10_Old"); this.wrw_so2_Old = (ToggleButton) base.FindName("wrw_so2_Old"); this.wrw_no2_Old = (ToggleButton) base.FindName("wrw_no2_Old"); this.wrw_o31_Old = (ToggleButton) base.FindName("wrw_o31_Old"); this.wrw_co_Old = (ToggleButton) base.FindName("wrw_co_Old"); this.ActuallyFrame = (Border) base.FindName("ActuallyFrame"); this.TabDivActually = (Grid) base.FindName("TabDivActually"); this.ActuallyLeftTabItem = (ColumnDefinition) base.FindName("ActuallyLeftTabItem"); this.ActuallyRightTabItem = (ColumnDefinition) base.FindName("ActuallyRightTabItem"); this.ActuallyPanelHeader = (Grid) base.FindName("ActuallyPanelHeader"); this.btnActuallyExpand = (PushedImageButton) base.FindName("btnActuallyExpand"); this.lbl_DateTime_WRW = (Run) base.FindName("lbl_DateTime_WRW"); this.LeftFrameWrwCollapsedBottomRectangle = (Rectangle) base.FindName("LeftFrameWrwCollapsedBottomRectangle"); this.ActuallyGrid = (Grid) base.FindName("ActuallyGrid"); this.LeftFrameTopRectangle = (Rectangle) base.FindName("LeftFrameTopRectangle"); this.dgWRW = (DataGrid) base.FindName("dgWRW"); this.wrwButtonsBorder = (Border) base.FindName("wrwButtonsBorder"); this.wrwButtons = (Canvas) base.FindName("wrwButtons"); this.PM25Storyboard = (Storyboard) base.FindName("PM25Storyboard"); this.PM10Storyboard = (Storyboard) base.FindName("PM10Storyboard"); this.SO2Storyboard = (Storyboard) base.FindName("SO2Storyboard"); this.NO2Storyboard = (Storyboard) base.FindName("NO2Storyboard"); this.O31Storyboard = (Storyboard) base.FindName("O31Storyboard"); this.COStoryboard = (Storyboard) base.FindName("COStoryboard"); this.wrw_pm25 = (ToggleButton) base.FindName("wrw_pm25"); this.wrw_so2 = (ToggleButton) base.FindName("wrw_so2"); this.wrw_no2 = (ToggleButton) base.FindName("wrw_no2"); this.wrw_o31 = (ToggleButton) base.FindName("wrw_o31"); this.wrw_co = (ToggleButton) base.FindName("wrw_co"); this.wrw_pm10 = (ToggleButton) base.FindName("wrw_pm10"); this.AirQualityFrame = (Border) base.FindName("AirQualityFrame"); this.TabDivQuality = (Grid) base.FindName("TabDivQuality"); this.QualityHeader = (Grid) base.FindName("QualityHeader"); this.QualityLeftTabItem = (ColumnDefinition) base.FindName("QualityLeftTabItem"); this.QualityRightTabItem = (ColumnDefinition) base.FindName("QualityRightTabItem"); this.QualityPanelHeader = (Grid) base.FindName("QualityPanelHeader"); this.btnQualityExpand = (PushedImageButton) base.FindName("btnQualityExpand"); this.QualityGrid = (Grid) base.FindName("QualityGrid"); this.lbl_DateTime_AQI = (Run) base.FindName("lbl_DateTime_AQI"); this.dgAQIGrid = (Grid) base.FindName("dgAQIGrid"); this.dgAQI = (DataGrid) base.FindName("dgAQI"); this.DayForecastPanel = (Border) base.FindName("DayForecastPanel"); this.TabDiv = (Grid) base.FindName("TabDiv"); this.yb_jl4_2 = (Grid) base.FindName("yb_jl4_2"); this.ForecaseLeftTabItem = (ColumnDefinition) base.FindName("ForecaseLeftTabItem"); this.ForecaseRightTabItem = (ColumnDefinition) base.FindName("ForecaseRightTabItem"); this.ForecastPanelHeader = (Grid) base.FindName("ForecastPanelHeader"); this.btnForecastExpand = (PushedImageButton) base.FindName("btnForecastExpand"); this.ForecastGridBorder = (Border) base.FindName("ForecastGridBorder"); this.forecastGrid = (DataGrid) base.FindName("forecastGrid"); this.forecastMsg = (Grid) base.FindName("forecastMsg"); this.ExpandButtonGrid = (Grid) base.FindName("ExpandButtonGrid"); this.Line1 = (Rectangle) base.FindName("Line1"); this.Line2 = (Rectangle) base.FindName("Line2"); this.Line3 = (Rectangle) base.FindName("Line3"); this.Line4 = (Rectangle) base.FindName("Line4"); this.btnExpand = (ToggleButton) base.FindName("btnExpand"); this.btnExpandTooTip = (TextBlock) base.FindName("btnExpandTooTip"); this.FloatWRWPopup = (FloatPopup) base.FindName("FloatWRWPopup"); this.WRWPopupBorder = (Border) base.FindName("WRWPopupBorder"); this.WRWPopupBackground = (Grid) base.FindName("WRWPopupBackground"); this.wrwqp_8 = (Grid) base.FindName("wrwqp_8"); this.wrwqp_9 = (Grid) base.FindName("wrwqp_9"); this.wrwqp_11 = (Grid) base.FindName("wrwqp_11"); this.wrwqp_12 = (Grid) base.FindName("wrwqp_12"); this.WRWChartPanel = (Grid) base.FindName("WRWChartPanel"); this.WRWExpandAnimation = (DoubleAnimation) base.FindName("WRWExpandAnimation"); this.WRWChart = (Chart) base.FindName("WRWChart"); this.WRWChartTitle = (TextBlock) base.FindName("WRWChartTitle"); this.XAxis = (DateTimeAxis) base.FindName("XAxis"); this.YAxis = (LinearAxis) base.FindName("YAxis"); this.WRWChartText = (TextBlock) base.FindName("WRWChartText"); this.wrwqp_16 = (Grid) base.FindName("wrwqp_16"); this.btnWRWExpand = (ToggleButton) base.FindName("btnWRWExpand"); this.FloatAQIPopup = (FloatPopup) base.FindName("FloatAQIPopup"); this.AQIPopupBorder = (Border) base.FindName("AQIPopupBorder"); this.AQIPopupBackground = (Grid) base.FindName("AQIPopupBackground"); this.aqi_26 = (Grid) base.FindName("aqi_26"); this.aqi_27 = (Grid) base.FindName("aqi_27"); this.aqi_28 = (Grid) base.FindName("aqi_28"); this.aqi_29 = (Grid) base.FindName("aqi_29"); this.aqi_30 = (Grid) base.FindName("aqi_30"); this.AQIPanel = (Grid) base.FindName("AQIPanel"); this.AQIExpandAnimation = (DoubleAnimation) base.FindName("AQIExpandAnimation"); this.AQIDataGrid = (DataGrid) base.FindName("AQIDataGrid"); this.AQIPopupBottom = (Grid) base.FindName("AQIPopupBottom"); this.btnAQIExpand = (ToggleButton) base.FindName("btnAQIExpand"); this.FloatForecastPopup = (FloatPopup) base.FindName("FloatForecastPopup"); this.ForecastBorder = (Border) base.FindName("ForecastBorder"); this.yb_2 = (Grid) base.FindName("yb_2"); this.ForecastPopupHeader = (Grid) base.FindName("ForecastPopupHeader"); this.ForecastNight = (Grid) base.FindName("ForecastNight"); this.ForecastNightStationName = (Grid) base.FindName("ForecastNightStationName"); this.yb_30 = (Grid) base.FindName("yb_30"); this.yb_39 = (Grid) base.FindName("yb_39"); this.yb_40 = (Grid) base.FindName("yb_40"); this.ForecastNightConent = (Grid) base.FindName("ForecastNightConent"); this.ForecastDay = (Grid) base.FindName("ForecastDay"); this.ForecastDayStationName = (Grid) base.FindName("ForecastDayStationName"); this.yb_61 = (Grid) base.FindName("yb_61"); this.yb_62 = (Grid) base.FindName("yb_62"); this.yb_65 = (Grid) base.FindName("yb_65"); this.yb_66 = (Grid) base.FindName("yb_66"); this.AlertWnd = (Marquee) base.FindName("AlertWnd"); this.MapRange = (TextBox) base.FindName("MapRange"); this.txtbWebCounts = (TextBlock) base.FindName("txtbWebCounts"); } }
/// <summary> /// Acquires an independent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireIndependentAxis() { IAxis independentAxis = SeriesHost.Axes .Where(a => (a.Orientation == AxisOrientation.X) && ((a is IRangeAxis) || (a is ICategoryAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue))) .FirstOrDefault(); if (null == independentAxis) { object probeValue = DataItems.Any() ? DataItems.First().ActualIndependentValue : null; double convertedDouble; DateTime convertedDateTime; if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDouble)) { independentAxis = new LinearAxis(); } else if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDateTime)) { independentAxis = new DateTimeAxis(); } else { independentAxis = new CategoryAxis(); } independentAxis.Orientation = AxisOrientation.X; } return independentAxis; }
public void UpdateGraph(DisplayCalculations calculations) { Chart.Series.Clear(); Chart.Axes.Clear(); DateTime baseTime = new DateTime(2000, 1, 1, 0, 0, 0); List<SpecialEffect> effectList = new List<SpecialEffect>(); effectList.AddRange(calculations.SpellPowerEffects); effectList.AddRange(calculations.IntellectEffects); effectList.AddRange(calculations.HasteRatingEffects); effectList.AddRange(calculations.MasteryRatingEffects); Color[] colors = new Color[] { Color.FromArgb(255,202,180,96), Color.FromArgb(255,101,225,240), Color.FromArgb(255,0,4,3), Color.FromArgb(255,238,238,30), Color.FromArgb(255,45,112,63), Color.FromArgb(255,121,72,210), Color.FromArgb(255,217,100,54), Color.FromArgb(255,210,72,195), Color.FromArgb(255,206,189,191), Color.FromArgb(255,255,0,0), Color.FromArgb(255,0,255,0), Color.FromArgb(255,0,0,255), }; Style dateTimeAxisLabelStyle = new Style(typeof(DateTimeAxisLabel)); dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.MinutesIntervalStringFormatProperty, "{0:m:ss}")); dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.SecondsIntervalStringFormatProperty, "{0:m:ss}")); DateTimeAxis timeAxis = new DateTimeAxis() { //Title = "Time", Minimum = baseTime, Maximum = baseTime + TimeSpan.FromSeconds(calculations.CalculationOptions.FightDuration), IntervalType = DateTimeIntervalType.Seconds, AxisLabelStyle = dateTimeAxisLabelStyle, Orientation = AxisOrientation.X, ShowGridLines = true, Location = AxisLocation.Top, }; for (int i = 0; i < effectList.Count; i++) { float procs = 0.0f; float triggers = 0.0f; for (int j = 0; j < calculations.SolutionVariable.Count; j++) { if (calculations.Solution[j] > 0) { Cycle c = calculations.SolutionVariable[j].Cycle; if (c != null) { switch (effectList[i].Trigger) { case Trigger.DamageSpellCrit: case Trigger.SpellCrit: triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime); procs += (float)(calculations.Solution[j] * c.CritProcs / c.CastTime); break; case Trigger.DamageSpellHit: case Trigger.SpellHit: triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime); procs += (float)(calculations.Solution[j] * c.HitProcs / c.CastTime); break; case Trigger.SpellMiss: triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime); procs += (float)(calculations.Solution[j] * (1 - c.HitProcs) / c.CastTime); break; case Trigger.DamageSpellCast: case Trigger.SpellCast: if (effectList[i].Stats.HolySummonedDamage > 0) { triggers += (float)(calculations.Solution[j] * c.CastProcs2 / c.CastTime); procs += (float)(calculations.Solution[j] * c.CastProcs2 / c.CastTime); } else { triggers += (float)(calculations.Solution[j] * c.CastProcs / c.CastTime); procs += (float)(calculations.Solution[j] * c.CastProcs / c.CastTime); } break; case Trigger.MageNukeCast: triggers += (float)(calculations.Solution[j] * c.NukeProcs / c.CastTime); procs += (float)(calculations.Solution[j] * c.NukeProcs / c.CastTime); break; case Trigger.DamageDone: case Trigger.DamageOrHealingDone: triggers += (float)(calculations.Solution[j] * c.DamageProcs / c.CastTime); procs += (float)(calculations.Solution[j] * c.DamageProcs / c.CastTime); break; case Trigger.DoTTick: triggers += (float)(calculations.Solution[j] * c.DotProcs / c.CastTime); procs += (float)(calculations.Solution[j] * c.DotProcs / c.CastTime); break; } } } } float triggerInterval = calculations.CalculationOptions.FightDuration / triggers; float triggerChance = Math.Min(1.0f, procs / triggers); int steps = 200; TimeData[] plot = new TimeData[steps + 1]; for (int tick = 0; tick <= steps; tick++) { float time = tick / (float)steps * calculations.CalculationOptions.FightDuration; plot[tick] = new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time), Value = effectList[i].GetUptimePlot(triggerInterval, triggerChance, 3.0f, time) }; } Style style = new Style(typeof(LineDataPoint)); style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, Resources["LineDataPointTemplate"])); style.Setters.Add(new Setter(LineDataPoint.BackgroundProperty, new SolidColorBrush(colors[i]))); Chart.Series.Add(new LineSeries() { Title = effectList[i].ToString(), ItemsSource = plot, IndependentValuePath = "Time", DependentValuePath = "Value", DataPointStyle = style, IndependentAxis = timeAxis, }); } }