public void LineThicknessDefaultValue() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); ChartGrid grid = new ChartGrid(); Axis axis = new Axis(); axis.Grids.Add(grid); chart.AxesY.Add(axis); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { Assert.AreEqual(0.25, grid.LineThickness); } window.Dispatcher.InvokeShutdown(); window.Close(); }
private void CreateChart() { // Create a Chart element Chart chart = new Chart(); Title chartTitle = new Title(); chartTitle.Margin = new Thickness(0, 0, 0, 5.0); chartTitle.Text = "Columns with " + ((ColumnScoreOption)CellsOption).ToString() + " cells"; chart.Titles.Add(chartTitle); chart.AnimatedUpdate = true; chart.BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Gray); chart.BorderThickness = new System.Windows.Thickness(0.5); chart.Padding = new System.Windows.Thickness(5, 5, 10, 5); chart.ShadowEnabled = true; chart.View3D = ChartType == 0 ? true : false; // Axis Y Axis newAxisY = new Axis(); newAxisY.Suffix = "%"; newAxisY.AxisMaximum = 100; ChartGrid chartGrid = new ChartGrid(); chartGrid.Interval = 1000; chartGrid.InterlacedColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White); newAxisY.Grids.Add(chartGrid); chart.AxesY.Add(newAxisY); // Axis X Axis newAxisX = new Axis(); newAxisX.LineThickness = 0; ChartGrid chartGridX = new ChartGrid(); chartGridX.Interval = 1; newAxisX.Grids.Add(chartGridX); chart.AxesX.Add(newAxisX); // Create new DataSeries DataSeries dataSeries = new DataSeries(); dataSeries.RenderAs = ChartType == 0 || ChartType == 1 ? RenderAs.Column : RenderAs.Line; foreach (ColumnScore columnScore in ColumnsScore) { // Create a DataPoint DataPoint dataPoint = new DataPoint(); dataPoint.AxisXLabel = columnScore.Name; // Set the YValue using random number dataPoint.YValue = columnScore.Score; // Add DataPoint to DataSeries dataSeries.DataPoints.Add(dataPoint); } // Add DataSeries to Chart chart.Series.Add(dataSeries); // Add chart for display ChartControl = chart; }
public void TestDateTimeWithCombinationCharts() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); Axis axis = new Axis(); axis.AxisLabels.Angle = -45; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); Int32 ds = 0; DataSeries dataSeries; for (ds = 0; ds < 5; ds++) { dataSeries = new DataSeries(); if (ds == 1 || ds == 3) dataSeries.RenderAs = RenderAs.Line; else if (ds == 4) dataSeries.RenderAs = RenderAs.Area; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 4, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 5, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 8, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); } Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { Assert.AreEqual(ds, chart.Series.Count); window.Dispatcher.InvokeShutdown(); window.Close(); } }
/// <summary> /// Set up grids for axis /// </summary> private void SetUpGrids() { if (Grids.Count == 0 && AxisRepresentation.ToString() != "AxisX") { ChartGrid chartGrid = new ChartGrid() { _isAutoGenerated = true }; Grids.Add(chartGrid); AddGridsIntoRootElement(chartGrid); } foreach (ChartGrid grid in Grids) { grid.IsNotificationEnable = false; grid.Maximum = AxisManager.AxisMaximumValue; grid.Minimum = AxisManager.AxisMinimumValue; grid.DataMaximum = Maximum; grid.DataMinimum = Minimum; grid.ParentAxis = this; if (PlotDetails.ChartOrientation == ChartOrientationType.Circular && grid.GetValue(ChartGrid.LineThicknessProperty) == null) grid.LineThickness = 0.50; grid.IsNotificationEnable = true; } }
public void InterlacedColorNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesY.Add(axis); CreateAsyncTask(chart, () => grid.InterlacedColor = new SolidColorBrush(Colors.LightGray), () => Common.AssertBrushesAreEqual(new SolidColorBrush(Colors.LightGray), grid.InterlacedColor)); EnqueueTestComplete(); }
public void IntervalNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesY.Add(axis); CreateAsyncTask(chart, () => grid.Interval = 20, () => Assert.AreEqual(20, grid.Interval)); EnqueueTestComplete(); }
public void EnabledNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesX.Add(axis); CreateAsyncTask(chart, () => grid.Enabled = true, () => Assert.IsTrue((Boolean)grid.Enabled), () => chart.AxesY[0].Grids[0].Enabled = false, () => Assert.IsFalse((Boolean)chart.AxesY[0].Grids[0].Enabled)); EnqueueTestComplete(); }
public void TestDateTimeWithAxisMinimumAndMaximum() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); TestPanel.Children.Add(chart); EnqueueConditional(() => { return _isLoaded; }); EnqueueDelay(_sleepTime); Axis axis = new Axis(); axis.AxisMinimum = new DateTime(2008, 12, 1, 1, 2, 4); axis.AxisMaximum = new DateTime(2009, 6, 1, 12, 4, 5); axis.AxisLabels = new AxisLabels(); axis.AxisLabels.Angle = -45; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); EnqueueCallback(() => { DataSeries dataSeries = new DataSeries(); dataSeries.XValueType = ChartValueTypes.DateTime; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1, 1, 3, 4), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1, 10, 12, 28), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 5, 1, 6, 2, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); }); EnqueueDelay(_sleepTime); EnqueueTestComplete(); }
/// <summary> /// IntervalProperty changed call back function /// </summary> /// <param name="d">DependencyObject</param> /// <param name="e">DependencyPropertyChangedEventArgs</param> private static void OnIntervalPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChartGrid chartGrid = d as ChartGrid; chartGrid.FirePropertyChanged(VcProperties.Interval); }
public void TestChartGridSerialization() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries ds = new DataSeries(); DataPoint dp = new DataPoint(); dp.YValue = 20; ds.DataPoints.Add(dp); chart.Series.Add(ds); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { MessageBox.Show(XamlWriter.Save(grid)); } window.Dispatcher.InvokeShutdown(); window.Close(); }
public void InterlacedColorNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); ChartGrid grid = new ChartGrid(); Axis axis = new Axis(); axis.Grids.Add(grid); chart.AxesY.Add(axis); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { grid.InterlacedColor = new SolidColorBrush(Colors.Gray); Common.AssertBrushesAreEqual(new SolidColorBrush(Colors.Gray), grid.InterlacedColor); } window.Dispatcher.InvokeShutdown(); window.Close(); }
public void OpacityNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); ChartGrid grid = new ChartGrid(); Axis axis = new Axis(); axis.Grids.Add(grid); chart.AxesY.Add(axis); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { grid.Opacity = 0.5; Assert.AreEqual(0.5, grid.Opacity, Common.HighPrecisionDelta); } window.Dispatcher.InvokeShutdown(); window.Close(); }
public void EnabledNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesX.Add(axis); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { grid.Enabled = true; Assert.IsTrue((Boolean)grid.Enabled); } window.Dispatcher.InvokeShutdown(); window.Close(); }
/// <summary> /// Dibuja el reporte seleccionado con los filtros asociados /// </summary> /// <param name="idReporte"></param> /// <param name="filtros"></param> public void draw(string idReporte, params string[] filtros) { IChart chart = FactoryChart.Instance.getReporte(idReporte); if (chart != null) { LayoutRoot.Children.Clear(); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); //axis.AxisOffset = 1.5; //axis.ValueFormatString = "000.00"; Chart newChar = chart.Draw(filtros); // Llenando los AxisXLAbel para llenar los huecos en las series. #region llenado de huecos if (idReporte != "EjecucionDeCalidad") { // Llenando los AxisXLAbel para llenar los huecos en las series. List<String> ciclosOrdered = chart.ObtenerCiclos(); ciclosOrdered.Sort(); List<DataSeries> oldSeries = new List<DataSeries>(); foreach (DataSeries dtemp in newChar.Series) { oldSeries.Add(dtemp); } newChar.Series.Clear(); foreach (DataSeries dtemp in oldSeries) { DataSeries dataSeries = new DataSeries(); dataSeries.Name = dtemp.Name; // Set DataSeries properties dataSeries.RenderAs = dtemp.RenderAs; dataSeries.MarkerType = dtemp.MarkerType; dataSeries.SelectionEnabled = dtemp.SelectionEnabled; dataSeries.LineThickness = dtemp.LineThickness; dataSeries.AxisYType = dtemp.AxisYType; dataSeries.AxisXType = dtemp.AxisXType; dataSeries.Padding = dtemp.Padding; //Iterando el distinct de los ciclos ordenados foreach (String cicloTmp in ciclosOrdered) { DataPoint dpTmp = obtenerPuntoPorLabel(dtemp, cicloTmp); if (dpTmp == null) { DataPoint dataPoint = new DataPoint(); dataPoint.AxisXLabel = cicloTmp; dataSeries.DataPoints.Add(dataPoint); } else { dataSeries.DataPoints.Add(dpTmp); } } if (idReporte == "SobreIndexados") { dataSeries.MouseLeftButtonDown += new MouseButtonEventHandler(dataSeries_MouseLeftButtonDown); dataSeries.MouseRightButtonDown += new MouseButtonEventHandler(dataSeries_MouseLeftButtonDown); gFiltros = filtros; } newChar.Series.Add(dataSeries); } } #endregion newChar.Style = (Style)FindResource("ChartStyle"); newChar.View3D = true; //newChar.DataPointWidth = 4.5; CornerRadius cr = new CornerRadius(20); newChar.CornerRadius = cr; newChar.ShadowEnabled = true; newChar.AxesY.Add(axis); newChar.ZoomingEnabled = true; try { newChar.Titles[0].Style = (Style)FindResource("TitleStyle"); PlotArea p = new PlotArea(); p.Padding = new Thickness(30); newChar.PlotArea = p; p.Background = Brushes.LightGray; if (newChar.AxesY.Count > 0 && newChar.AxesY[0].Grids.Count > 0) { newChar.AxesY[0].Grids[0].InterlacedColor = Brushes.White; } //Asignando una serie dummy para que salga la leyenda cuando se tiene una sola serie. if (newChar.Series.Count == 1 && newChar.Series[0].DataPoints.Count>0) { DataSeries dataSeries = new DataSeries(); // Set DataSeries properties dataSeries.RenderAs = RenderAs.Line; dataSeries.ShowInLegend = false; dataSeries.Name = "HIDDENSERIE"; newChar.Series.Add(dataSeries); } } catch(Exception e) { string s = e.Message; } LayoutRoot.Children.Add(newChar); } }
/// <summary> /// EnabledProperty changed call back function /// </summary> /// <param name="d">DependencyObject</param> /// <param name="e">DependencyPropertyChangedEventArgs</param> private static void OnEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChartGrid chartGrid = d as ChartGrid; chartGrid.FirePropertyChanged(VcProperties.Enabled); }
public void TestGridAlignment() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; chart.Padding = new Thickness(6); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); TestPanel.Children.Add(chart); Axis axis = new Axis(); axis.ValueFormatString = "dd MMM yyyy"; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries dataSeries = new DataSeries(); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 11, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 12, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2010, 10, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); EnqueueDelay(2000); EnqueueTestComplete(); }
public void TestGridAlignment() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; chart.Padding = new Thickness(6); _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); Axis axis = new Axis(); axis.ValueFormatString = "dd MMM yyyy"; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries dataSeries = new DataSeries(); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 11, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 12, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2010, 10, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { window.Dispatcher.InvokeShutdown(); window.Close(); } }
public void TestDateTimeWithCombinationCharts() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); TestPanel.Children.Add(chart); EnqueueConditional(() => { return _isLoaded; }); EnqueueDelay(_sleepTime); Axis axis = new Axis(); axis.AxisLabels = new AxisLabels(); axis.AxisLabels.Angle = -45; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); Int32 ds = 0; EnqueueCallback(() => { DataSeries dataSeries; for (ds = 0; ds < 5; ds++) { dataSeries = new DataSeries(); if (ds == 1 || ds == 3) dataSeries.RenderAs = RenderAs.Line; else if (ds == 4) dataSeries.RenderAs = RenderAs.Area; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 4, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 5, 1), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 8, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); } }); EnqueueCallback(() => { Assert.AreEqual(ds, chart.Series.Count); }); EnqueueDelay(_sleepTime); EnqueueTestComplete(); }
public void TestTimeAsXValueType() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); Axis axis = new Axis(); axis.IntervalType = IntervalTypes.Minutes; axis.Interval = 20; axis.AxisLabels.Angle = -45; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries dataSeries = new DataSeries(); dataSeries.XValueType = ChartValueTypes.Time; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1, 1, 3, 4), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 8, 10, 12, 28), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 8, 6, 6, 2, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { window.Dispatcher.InvokeShutdown(); window.Close(); } }
public void OpacityNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesX.Add(axis); CreateAsyncTask(chart, () => grid.Opacity = 0.5, () => Assert.AreEqual(0.5, grid.Opacity, Common.HighPrecisionDelta), () => chart.AxesY[0].Grids[0].Opacity = 0.5, () => Assert.AreEqual(0.5, chart.AxesY[0].Grids[0].Opacity, Common.HighPrecisionDelta)); EnqueueTestComplete(); }
public void TestTimeWithDefaultDate() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); Axis axis = new Axis(); axis.ValueFormatString = "dd/MM/yyyy hh:mm:ss tt"; ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries dataSeries = new DataSeries(); dataSeries.XValueType = ChartValueTypes.Time; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1, 1, 3, 4), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 3, 8, 10, 12, 28), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 8, 6, 6, 2, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { window.Dispatcher.InvokeShutdown(); window.Close(); } }
public void LineStyleNewValue() { Chart chart = new Chart(); chart.Width = 400; chart.Height = 300; Common.CreateAndAddDefaultDataSeries(chart); Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); axis.Grids.Add(grid); chart.AxesY.Add(axis); CreateAsyncTask(chart, () => grid.LineStyle = LineStyles.Dashed, () => Assert.AreEqual(LineStyles.Dashed, grid.LineStyle)); EnqueueTestComplete(); }
public void TestDateTimeWithAxisMinimumAndMaximum() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); Axis axis = new Axis(); axis.AxisMinimum = new DateTime(2008, 12, 1, 1, 2, 4); axis.AxisMaximum = new DateTime(2009, 6, 1, 12, 4, 5); ChartGrid grid = new ChartGrid(); grid.Enabled = true; axis.Grids.Add(grid); chart.AxesX.Add(axis); DataSeries dataSeries = new DataSeries(); dataSeries.XValueType = ChartValueTypes.DateTime; dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1, 1, 3, 4), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 2, 1, 10, 12, 28), YValue = rand.Next(10, 100) }); dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 5, 1, 6, 2, 1), YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); Window window = new Window(); window.Content = chart; window.Show(); if (_isLoaded) { window.Dispatcher.InvokeShutdown(); window.Close(); } }
public void TestMultipleGridsInAxis4HorizontalCharts() { Chart chart = new Chart(); chart.Width = 500; chart.Height = 300; _isLoaded = false; chart.Loaded += new RoutedEventHandler(chart_Loaded); Random rand = new Random(); TestPanel.Children.Add(chart); EnqueueConditional(() => { return _isLoaded; }); EnqueueDelay(_sleepTime); DataSeries dataSeries = new DataSeries(); dataSeries.RenderAs = RenderAs.Bar; for (Int32 i = 0; i < 6; i++) dataSeries.DataPoints.Add(new DataPoint() { AxisXLabel = "Visifire", YValue = rand.Next(10, 100) }); chart.Series.Add(dataSeries); EnqueueCallback(() => { Axis axis = new Axis(); ChartGrid grid = new ChartGrid(); grid.Interval = 1; grid.LineColor = new SolidColorBrush(Colors.Red); grid.LineThickness = 1; axis.Grids.Add(grid); grid = new ChartGrid(); grid.Interval = 0.5; grid.LineColor = new SolidColorBrush(Colors.Green); grid.LineThickness = 0.8; axis.Grids.Add(grid); chart.AxesX.Add(axis); }); EnqueueDelay(_sleepTime); EnqueueTestComplete(); }
private void AddGridsIntoRootElement(ChartGrid grid) { if (_rootElement != null) { grid.IsNotificationEnable = false; #if WPF if (IsInDesignMode) ObservableObject.RemoveElementFromElementTree(grid); #endif if (!_rootElement.Children.Contains(grid)) _rootElement.Children.Add(grid); grid.IsNotificationEnable = true; grid.IsTabStop = false; } }