public void ShouldShowChart2() { var chart = new SeasonalityChartSingle(); chart.Create(); var x = new[] { "-5", "-4", "-3", "-2", "-1", "0", "1", "2", "3", "4", "5" }; var y = new[] { 10.2, 12.3, 33.0, 24, 65, 36, 17, 28, 19, 25, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; chart.AddLineChart("test data", x, y); chart.VerticalLinesXValuesLabels = new Dictionary<string,string> {{"-4","event1"}, {"3","event2"}}; var form = chart.DisplayInShowForm("Seasonality Test"); LookFeel.SetupBenNew(); form.BackColor = Color.LightSlateGray; LookFeel.ProcessControl(form); Application.Run(form); }
private void Rescale(SeasonalityChartSingle[] ctrls, bool hasLivePt=false) { if (m_displayOptions.FieldToShow == DataAroundEventField.Filled_Level) { foreach (var c in ctrls) { c.ClearYAxisLimits(); c.AddLegend(); } } else { var chartsMinMax = new List<double[]>(); foreach (var c in ctrls) { var chartLimits = c.FindLineChartMinMax(m_displayOptions.StatsVisible); chartsMinMax.Add(chartLimits); if (m_displayOptions.YAxesRoundUp) { var scaleTop = Math.Pow(10d, Math.Floor(Math.Log(chartLimits[1])/2.302)); chartLimits[1] = Math.Ceiling(chartLimits[1]/scaleTop)*scaleTop; var scalBottom = Math.Pow(10d, Math.Floor(Math.Log(Math.Abs(chartLimits[0]))/2.303)); chartLimits[0] = Math.Floor(chartLimits[0]/scalBottom)*scalBottom; } if (m_displayOptions.YAXesSymmetric) { chartLimits[1] = Math.Max(Math.Abs(chartLimits[0]), Math.Abs(chartLimits[1])) * (hasLivePt ? 1.1 : 1.0); if (hasLivePt) { if (chartLimits[1] < chartScaleLimit) chartLimits[1] = chartScaleLimit; else chartScaleLimit = chartLimits[1]; } chartLimits[0] = -chartLimits[1]; } if (!m_displayOptions.YAxesSameScale) { c.SetYAxisLimits( m_displayOptions.YAXesSymmetric ? Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom : Infragistics.UltraChart.Shared.Styles.AxisRangeType.Automatic, chartLimits[1], chartLimits[0]); } c.AddLegend(); } if (m_displayOptions.YAxesSameScale) { var lowestMin = chartsMinMax.Select(x => x[0]).Min(); var highestMax = chartsMinMax.Select(x => x[1]).Max(); foreach (var c in ctrls) { c.SetYAxisLimits( m_displayOptions.YAXesSymmetric ? Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom : Infragistics.UltraChart.Shared.Styles.AxisRangeType.Automatic, highestMax, lowestMin); } } } }