Example #1
0
        public void CheckDefaultLineThickness()
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;

            Common.CreateAndAddDefaultDataSeries(chart);
            Ticks tick = new Ticks();
            Axis axis = new Axis();
            axis.Ticks.Add(tick);
            chart.AxesX.Add(axis);
              
            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                Assert.AreEqual(0.5, tick.LineThickness);
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
Example #2
0
        public void TestMultipleTicksInAxis4HorizontalCharts()
        {
            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();
                Ticks tick = new Ticks();
                tick.Interval = 1;
                tick.LineColor = new SolidColorBrush(Colors.Red);
                tick.LineThickness = 1;
                axis.Ticks.Add(tick);
                tick = new Ticks();
                tick.Interval = 0.5;
                tick.LineColor = new SolidColorBrush(Colors.Green);
                tick.LineThickness = 0.8;
                axis.Ticks.Add(tick);
                chart.AxesX.Add(axis);
            });

            EnqueueDelay(_sleepTime);
            EnqueueTestComplete();
        }
Example #3
0
        /// <summary>
        /// Set up ticks for axis
        /// </summary>
        private void SetUpTicks()
        {
            if (Ticks.Count == 0)
            {
                Ticks ticks = new Ticks() { _isAutoGenerated = true };
                Ticks.Add(ticks);
                //AddTickElementIntoRootElement(ticks);
            }

            foreach (Ticks tick in Ticks)
            {
                tick.IsNotificationEnable = false;

                if (AxisRepresentation.ToString() == "AxisX")
                    tick.ApplyStyleFromTheme(Chart, "AxisXTicks");
                else if (AxisRepresentation.ToString() == "AxisY")
                    tick.ApplyStyleFromTheme(Chart, "AxisYTicks");

                tick.Maximum = AxisManager.AxisMaximumValue;
                tick.Minimum = AxisManager.AxisMinimumValue;
                tick.DataMaximum = Maximum;
                tick.DataMinimum = Minimum;
                tick.ParentAxis = this;

                if (PlotDetails.ChartOrientation == ChartOrientationType.Circular)
                {
                    if(tick.GetValue(Visifire.Charts.Ticks.TickLengthProperty) == null)
                        tick.TickLength = 2.3;
                }

                tick.IsNotificationEnable = true;
            }
        }
Example #4
0
        private void AddTickElementIntoRootElement(Ticks ticks)
        {
            if (_rootElement != null)
            {
                ticks.IsNotificationEnable = false;
#if WPF
                if (IsInDesignMode)
                    ObservableObject.RemoveElementFromElementTree(ticks);
#endif

                if (!_rootElement.Children.Contains(ticks))
                    _rootElement.Children.Add(ticks);

                ticks.IsNotificationEnable = true;
                ticks.IsTabStop = false;
            }
        }
Example #5
0
        public void TestTicksSerialization()
        {
            Chart chart = new Chart();
            chart.Width = 400;
            chart.Height = 300;

            _isLoaded = false;

            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Axis axis = new Axis();
            Ticks ticks = new Ticks();
            ticks.LineColor = new SolidColorBrush(Colors.Blue);
            axis.Ticks.Add(ticks);
            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(ticks));
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
Example #6
0
        public void CheckNewLineColor()
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;

            Common.CreateAndAddDefaultDataSeries(chart);
            Ticks tick = new Ticks();
            Axis axis = new Axis();
            axis.Ticks.Add(tick);
            chart.AxesX.Add(axis);
              
            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                tick.LineColor = new SolidColorBrush(Colors.Blue);
                Common.AssertBrushesAreEqual(new SolidColorBrush(Colors.Blue), tick.LineColor);
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
Example #7
0
        public void CheckNewEnabled()
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;

            Common.CreateAndAddDefaultDataSeries(chart);
            Ticks tick = new Ticks();
            Axis axis = new Axis();
            axis.Ticks.Add(tick);
            chart.AxesX.Add(axis);
              
            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                tick.Enabled = true;
                Assert.IsTrue((Boolean)tick.Enabled);
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }