Пример #1
0
        public void TestDateTimeWithSingleDataPoint()
        {
            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);

            EnqueueCallback(() =>
            {
                DataSeries dataSeries = new DataSeries();
                DataPoint dataPoint = new DataPoint();
                dataPoint.XValue = new DateTime(2009, 1, 1);
                dataPoint.YValue = rand.Next(10, 100);
                dataSeries.DataPoints.Add(dataPoint);

                chart.Series.Add(dataSeries);
            });

            EnqueueCallback(() =>
            {
                Assert.AreEqual(1, chart.Series[0].DataPoints.Count);
            });

            EnqueueDelay(_sleepTime);
            EnqueueTestComplete();
        }
Пример #2
0
        public void TestDateTimeWithTwoDataPoints()
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;

            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Random rand = new Random();

            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, 1, 2), YValue = rand.Next(10, 100) });

            chart.Series.Add(dataSeries);

            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                Assert.AreEqual(2, chart.Series[0].DataPoints.Count);
                window.Dispatcher.InvokeShutdown();
                window.Close();
            }
        }
Пример #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.VisualStateGroup = ((System.Windows.VisualStateGroup)(target));
                return;

            case 3:
                this.GridOn = ((System.Windows.VisualState)(target));
                return;

            case 4:
                this.GridOff = ((System.Windows.VisualState)(target));
                return;

            case 5:
                this.grid1 = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.FullFigure = ((Visifire.Charts.DataSeries)(target));
                return;

            case 7:
                this.grid = ((System.Windows.Controls.Grid)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #4
0
        /// <summary>
        /// Regresh chart
        /// </summary>
        private void button_Click(object sender, RoutedEventArgs e)
        {
            chart.Series.Clear();
            // Create series for each matrix size
            for (int size = 10; size <= 30; size += 5)
            {
                // Prepare series
                DataSeries series = new DataSeries();
                series.RenderAs = RenderAs.Line;
                series.ShowInLegend = true;
                series.LegendText = size.ToString();
                series.LineThickness = 2;

                // Get total count of cells in square matrix
                int cellCount = size * size;
                // Fill matrix with different percent of "zero" cells (from 1% to 100%)
                for (double arcPercent = 0.01; arcPercent <= 1; arcPercent += percentStep)
                {
                    // Calculate statistics of conflicts for all experiments
                    double conflicts = 0;
                    for (int experiment = 0; experiment < experiments; experiment++)
                        if (Matrix.HasConflict(Matrix.RandomMatrix(size, (int)(arcPercent * cellCount))))
                            conflicts++;
                    // Plot point (add to series)
                    DataPoint point = new DataPoint();
                    point.XValue = arcPercent * 100;
                    point.YValue = conflicts / experiments;
                    series.DataPoints.Add(point);
                }
                chart.Series.Add(series);
            }
        }
        public void ImportLineData(ArrayList values1, ArrayList values2)
        {
            dsc = new DataSeriesCollection();
            DataSeries ds1 = new DataSeries();
            ds1.RenderAs = RenderAs.Line;
            ds1.LegendText = "ObjValue";
            for (int i = 0; i < values1.Count; i = i + 4)
            {
                DataPoint dp = new DataPoint();
                dp.YValue = (double)values1[i];
                dp.XValue = i;
                ds1.DataPoints.Add(dp);
            }

            DataSeries ds2 = new DataSeries();
            ds2.RenderAs = RenderAs.Line;
            ds2.LegendText = "Variance";
            for (int i = 0; i < values2.Count; i = i + 4)
            {
                DataPoint dp = new DataPoint();
                dp.YValue = (double)values2[i];
                dp.XValue = i;
                ds2.DataPoints.Add(dp);
            }
            dsc.Add(ds1);
            dsc.Add(ds2);

        }
 //柱状图
 private void barGraph_Click(object sender, RoutedEventArgs e)
 {
     graphContainer.Children.Clear();
     Chart chart = new Chart();
     chart.Watermark = false;
     chart.View3D = true;
     chart.Width = 300;
     chart.Height = 200;
     Title title = new Title();
     title.Text = "人口类别统计图";
     chart.Titles.Add(title);
     for (int i = 0; i < 8; i++)
     {
         DataSeries dataSeries = new DataSeries();
         dataSeries.ShowInLegend = false;
         dataSeries.RenderAs = RenderAs.Column;
         for (int loopIndex = 0; loopIndex < 3; loopIndex++)
         {
             DataPoint dataPoint = new DataPoint();
             dataPoint.AxisXLabel = pop[loopIndex];
             dataPoint.YValue = points[i, loopIndex];
             dataSeries.DataPoints.Add(dataPoint);
         }
         chart.Series.Add(dataSeries);
     }
     //将柱状图添加到 Grid 控件以固定位置
     graphContainer.VerticalAlignment = VerticalAlignment.Top;
     graphContainer.HorizontalAlignment = HorizontalAlignment.Left;
     graphContainer.Children.Add(chart);
 }
Пример #7
0
        public Chart CreateChart(ChartInformation ci)
        {
            Chart m_chart = new Chart();
            m_chart.BorderThickness = ci.m_BorderThickness;
            m_chart.Theme = ci.m_Theme;
            m_chart.View3D = ci.m_View3D;

            Axis m_axisX = new Axis();
            m_axisX.Title = ci.m_axisXTitle;
            m_chart.AxesX.Add(m_axisX);

            Axis m_asixY = new Axis();
            m_asixY.Title = ci.m_axisYTitle;
            m_asixY.Enabled = true;
            m_asixY.StartFromZero = true;
            m_asixY.AxisType = AxisTypes.Primary;
            m_asixY.AxisMaximum = ci.m_axisYMaximum;
            m_asixY.Interval = ci.m_axisYInterval;
            m_chart.AxesY.Add(m_asixY);
            for(int i = 0;i<ci.dsc.Count;i++)
            {
                DataSeries ds = new DataSeries();
                ds.LegendText = ci.dsc[i].LegendText;
                ds.RenderAs = ci.dsc[i].RenderAs;
                ds.AxisYType = ci.dsc[i].AxisYType;
                ds.DataPoints = new DataPointCollection(ci.dsc[i].DataPoints);
                m_chart.Series.Add(ds);
            }
            m_chart.Rendered+=new EventHandler(chart_Rendered);
            return m_chart;
        }
Пример #8
0
 public static void AddDataToDataSerise(DataSeries ds,List<double> list)
 {
     double allCount = 100;
     double value = allCount / list.Count;
     for (int i = 0; i < list.Count; i++)
     {
         DataPoint dp = new DataPoint() { YValue = System.Math.Abs(list[i]) * 0.1, XValue = i * value };
         ds.DataPoints.Add(dp);
     }
 }
Пример #9
0
        /// <summary>
        /// Create Polar series
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="series"></param>
        /// <param name="polarCanvas"></param>
        /// <param name="labelCanvas"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="plotGroup"></param>
        /// <param name="circularPlotDetails"></param>
        private static void CreatePolarSeries(Chart chart, DataSeries series, Canvas polarCanvas, Canvas labelCanvas, Double width, Double height, PlotGroup plotGroup, CircularPlotDetails circularPlotDetails)
        {
            List<List<DataPoint>> brokenLineDataPointsGroup = GetBrokenLineDataPointsGroup(series, circularPlotDetails, plotGroup);
            foreach (List<DataPoint> dataPointList in brokenLineDataPointsGroup)
            {
                foreach (DataPoint dataPoint in dataPointList)
                    DrawMarker(dataPoint, labelCanvas, width, height, circularPlotDetails.Center);

                DrawDataSeriesPath(series, dataPointList, polarCanvas);
            }
        }
        /// <summary>
        /// Show chart with data series
        /// </summary>
        /// <param name="dataSeries"></param>
        public void LoadPriceChart(TradeRobotics.Model.StockDataSeries dataSeries)
        {
            //List<Bar> bars = dataSeries.Bars;
            Visifire.Charts.DataSeries ds = new DataSeries();
            ds.RenderAs = RenderAs.CandleStick;
            ds.MarkerEnabled = true;
            ds.MovingMarkerEnabled = true;
            ds.LightingEnabled = true;
            ds.LineThickness = 1.5;
            //ds.XValueType = ChartValueTypes.DateTime;
            ds.LegendText = string.Concat(dataSeries.Symbol, " ", dataSeries.Period);
            ds.PriceUpColor = new SolidColorBrush(Colors.Green);
            ds.PriceDownColor = new SolidColorBrush(Colors.Red);

            //PriceChart.AxesY[0].AxisMinimum = bars.Min(bar => bar.Low);
            //PriceChart.AxesY[0].AxisMaximum = bars.Max(bar => bar.High);
            PriceChart.AxesY[0].StartFromZero = false;
            PriceChart.AxesY[0].ViewportRangeEnabled = true;

            if (dataSeries.Bars.Count > 0)
            {
                // Add points
                //for (int i = 0; i < dataSeries.Count; i++)
                foreach (Bar bar in dataSeries.Bars)
                {
                    ds.DataPoints.Add(new DataPoint
                    {
                        AxisXLabel = bar.Time.ToString("yyyy-MM-dd HH:mm"),
                        //ToolTipText = "aa\nbb",
                        //XValue = bar.Time, // a DateTime value
                        YValues = new double[] { bar.Open, bar.Close, bar.High, bar.Low }
                        //dataSeries.Close[i], dataSeries.High[i], dataSeries.Low[i] } // a double value
                    });
                }
            }
            else
            {
                foreach (Quote quote in dataSeries.Quotes)
                {
                    ds.DataPoints.Add(new DataPoint
                    {
                        AxisXLabel = quote.Time.ToString("yyyy-MM-dd HH:mm"),
                        //ToolTipText = "aa\nbb",
                        //XValue = bar.Time, // a DateTime value
                        YValues = new double[] { quote.Price, quote.Price, quote.Price, quote.Price }
                        //dataSeries.Close[i], dataSeries.High[i], dataSeries.Low[i] } // a double value
                    });
                }
            }

            PriceChart.Series.Add(ds);
            PriceChart.ZoomingEnabled = true;
        }
Пример #11
0
        public void ColumnChartPerformanceTest()
        {
            Double totalDuration = 0;
            DateTime start = DateTime.UtcNow;

            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;
            chart.View3D = false;

            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Axis axisX = new Axis();
            axisX.Interval = 1;
            chart.AxesX.Add(axisX);

            Random rand = new Random();

            Int32 numberOfSeries = 0;
            DataSeries dataSeries = null;
            Int32 numberofDataPoint = 0;

            String msg = Common.AssertAverageDuration(100, 1, delegate
            {
                dataSeries = new DataSeries();
                dataSeries.RenderAs = RenderAs.Column;

                for (Int32 i = 0; i < 1000; i++)
                {
                    DataPoint dataPoint = new DataPoint();
                    dataPoint.AxisXLabel = "a" + i;
                    dataPoint.YValue = rand.Next(-100, 100);
                    dataSeries.DataPoints.Add(dataPoint);
                    numberofDataPoint++;
                }
                numberOfSeries++;
                chart.Series.Add(dataSeries);
            });

            window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                DateTime end = DateTime.UtcNow;
                totalDuration = (end - start).TotalSeconds;

                MessageBox.Show("Total Chart Loading Time: " + totalDuration + "s" + "\n"  + "Number of Render Count: " + chart.ChartArea._renderCount + "\n" + "Series Calculation: " + msg);
            }
            window.Dispatcher.InvokeShutdown();
        }
Пример #12
0
        public void Balance(int earning, int expense)
        {
            var chart = new Chart {Width = 500, Height = 300, View3D = true};
            chart.Titles.Add(new Title {Text = "Cân bằng tài chính"});
            var dataSeries = new DataSeries {RenderAs = RenderAs.Column};

            dataSeries.DataPoints.Add(new DataPoint {YValue = earning, AxisXLabel = "Tổng thu nhập"});
            dataSeries.DataPoints.Add(new DataPoint {YValue = expense, AxisXLabel = "Tổng chi tiêu"});

            chart.Series.Add(dataSeries);
            LayoutRoot.Children.Clear();
            LayoutRoot.Children.Add(chart);
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Map;component/Chart1.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.Chart = ((Visifire.Charts.Chart)(this.FindName("Chart")));
     this.DataSeries = ((Visifire.Charts.DataSeries)(this.FindName("DataSeries")));
     this.tb = ((System.Windows.Controls.TextBox)(this.FindName("tb")));
     this.MyGrid = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("MyGrid")));
 }
Пример #14
0
        public void TestDataPointPropertyChanged()
        {
            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();
            DataPoint dataPoint = null;

            for (Int32 i = 0; i < 10; i++)
            {
                dataPoint = new DataPoint();
                dataPoint.XValue = i + 1;
                dataPoint.YValue = rand.Next(10, 100);

                dataPoint.PropertyChanged += delegate(Object sender, System.ComponentModel.PropertyChangedEventArgs e)
                {
                    Assert.IsNotNull(e.PropertyName);
                    if (e.PropertyName == "XValue")
                        Assert.AreEqual("XValue", e.PropertyName);
                    else if (e.PropertyName == "YValue")
                        Assert.AreEqual("YValue", e.PropertyName);
                    else
                        Assert.IsNotNull(e.PropertyName);
                };

                dataSeries.DataPoints.Add(dataPoint);
            }

            chart.Series.Add(dataSeries);

            EnqueueCallback(() =>
            {
                dataPoint.XValue = 10;
                dataPoint.YValue = rand.Next(-100, 100);
            });

            EnqueueDelay(_sleepTime);
            EnqueueTestComplete();

        }
        public void ImportLineData(ArrayList values)
        {
            dsc = new DataSeriesCollection();
            DataSeries ds = new DataSeries();
            ds.RenderAs = RenderAs.Line;
            foreach (Object value in values)
            {
                DataPoint dp = new DataPoint();
                dp.YValue = (double)value;
                ds.DataPoints.Add(dp);
            }

            dsc.Add(ds);

        }
Пример #16
0
 private void SetChartData(DataTable dt,string strname, string linecolor)
 {
     Visifire.Charts.DataSeries dataSeries = new Visifire.Charts.DataSeries();
     AddDataSeries(strname, dataSeries, LineStyles.Solid, new SolidColorBrush((Color)ColorConverter.ConvertFromString(linecolor)), Visifire.Charts.RenderAs.QuickLine);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         Visifire.Charts.DataPoint dataPoint = new DataPoint();
         dataPoint.AxisXLabel = dt.Rows[i]["time"].ToString();
         dataPoint.Color = new SolidColorBrush(Colors.Blue);
         dataPoint.YValue = Convert.ToDouble(dt.Rows[i]["value"]);
         dataPoint.Tag = " ";
         dataSeries.DataPoints.Add(dataPoint);
     }
     this.chartC.Series.Add(dataSeries);
 }
Пример #17
0
 private void AddSeries(Chart c, List<double> list,bool showInLengend,string lengendText)
 {
     DataSeries ds = new DataSeries();
     ds.ShowInLegend = showInLengend;
     ds.RenderAs = RenderAs.QuickLine;
     if (showInLengend) {
         ds.Color = avgBrush;
         ds.LegendText = lengendText;
     }
     for (int i = 0; i < list.Count; i++)
     {
         DataPoint dp = new DataPoint() { YValue = Math.Abs(list[i]) };
         ds.DataPoints.Add(dp);
     }
     c.Series.Add(ds);
 }
Пример #18
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((Apollo.TrafficRateRealtime)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.VisualStateGroup = ((System.Windows.VisualStateGroup)(target));
                return;

            case 4:
                this.GridOn = ((System.Windows.VisualState)(target));
                return;

            case 5:
                this.GridOff = ((System.Windows.VisualState)(target));
                return;

            case 6:
                this.grid1 = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.CurRate = ((Visifire.Charts.Title)(target));
                return;

            case 8:
                this.Realtime = ((Visifire.Charts.DataSeries)(target));
                return;

            case 9:
                this.grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.currentRate = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #19
0
 public static void InitDataSerise(DataSeries ds, bool showInLengend, string lengendText, Brush brush,RenderAs render)
 {
     if (ds == null)
     {
         ds = new DataSeries();
     }
     ds.ShowInLegend = showInLengend;
     ds.RenderAs = render;
     if (brush != null)
     {
         ds.Color = brush;
     }
     if (showInLengend)
     {
         ds.LegendText = lengendText;
     }
 }
Пример #20
0
        public PlotAnchorable(string ID)
        {
            this.ID = ID;

            this.Title = ID;
            this.Content = chart;

            chart.AnimationEnabled = false;
            chart.LightingEnabled = false;
            chart.ScrollingEnabled = false;
            chart.AxesX.Add(new Axis() { Interval = 8 });

            serie = new DataSeries();
            serie.RenderAs = RenderAs.QuickLine;

            chart.Series.Add(serie);
        }
Пример #21
0
        public void TestDataPointPropertyChanged()
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 300;

            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Random rand = new Random();

            DataSeries dataSeries = new DataSeries();
            DataPoint dataPoint = null;

            for (Int32 i = 0; i < 10; i++)
            {
                dataPoint = new DataPoint();
                dataPoint.XValue = i + 1;
                dataPoint.YValue = rand.Next(10, 100);

                dataPoint.PropertyChanged += delegate(Object sender, System.ComponentModel.PropertyChangedEventArgs e)
                {
                    Assert.IsNotNull(e.PropertyName);
                    if (e.PropertyName == "XValue")
                        Assert.AreEqual("XValue", e.PropertyName);
                    else
                        Assert.AreEqual("YValue", e.PropertyName);
                        
                };

                dataSeries.DataPoints.Add(dataPoint);
            }
            chart.Series.Add(dataSeries);
            
            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                dataPoint.XValue = 10;
                dataPoint.YValue = rand.Next(-100, 100);
            }
       
            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
Пример #22
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((Apollo.BERChart)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.myChart = ((Visifire.Charts.DataSeries)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #23
0
        public MainWindow()
        {
            InitializeComponent();
            List<Task> tasks=  XMLModule.XMLLogic.XmlLogic.ReadXml(@"C:\Users\LaM\Desktop\TimeIsMoney\todoTimeIsMoney.tdl");
            MainList.ItemsSource = tasks;

            DataSeries serie = new DataSeries();
            serie.RenderAs = RenderAs.Column;

            Dictionary<DateTime, int> days = ReportEngine.GetCompletedTasksPerDay(tasks);

            foreach (KeyValuePair<DateTime, int> day in days)
            {
                serie.DataPoints.Add(new DataPoint() { XValue = day.Key, YValue = day.Value });
            }

            PlotChart.Series.Add(serie);
        }
Пример #24
0
        /// <summary>
        /// Function to create a chart
        /// </summary>
        public void CreateChart()
        {
            // Create a new instance of Chart
            Chart chart = new Chart();

            // Set the chart width and height
            //chart.Width = 500;
            //chart.Height = 300;

            // Create a new instance of Title
            Title title = new Title();

            // Set title property
            title.Text = "Visifire Sample Chart";

            // Add title to Titles collection
            chart.Titles.Add(title);

            // Create a new instance of DataSeries
            DataSeries dataSeries = new DataSeries();

            // Set DataSeries property
            dataSeries.RenderAs = RenderAs.Column;

            // Create a DataPoint
            DataPoint dataPoint;

            for (int i = 0; i < 5; i++) {
                // Create a new instance of DataPoint
                dataPoint = new DataPoint();

                // Set YValue for a DataPoint
                dataPoint.YValue = rand.Next(10, 100);

                // Add dataPoint to DataPoints collection
                dataSeries.DataPoints.Add(dataPoint);
            }

            // Add dataSeries to Series collection.
            chart.Series.Add(dataSeries);

            // Add chart to LayoutRoot
            LayoutRoot.Children.Add(chart);
        }
Пример #25
0
        /// <summary>
        /// Apply animation for point chart
        /// </summary>
        /// <param name="pointGrid">Point chart grid</param>
        /// <param name="storyboard">Stroyboard</param>
        /// <param name="width">Width of the chart canvas</param>
        /// <param name="height">Height of the chart canvas</param>
        /// <returns>Storyboard</returns>
        private static Storyboard ApplyPointChartAnimation(DataSeries currentDataSeries, Panel pointGrid, Storyboard storyboard, Double width, Double height)
        {   
#if WPF
            if (storyboard != null && storyboard.GetValue(System.Windows.Media.Animation.Storyboard.TargetProperty) != null)
                storyboard.Stop();
#else
            if (storyboard != null)
                storyboard.Stop();
#endif

            TransformGroup group = new TransformGroup();
            ScaleTransform scaleTransform = new ScaleTransform() { ScaleX = 0, ScaleY = 0, CenterX = 0.5, CenterY = 0.5 };
            TranslateTransform translateTransform = new TranslateTransform() { X = 0, Y = 0 };
            group.Children.Add(scaleTransform);
            group.Children.Add(translateTransform);

            pointGrid.RenderTransform = group;

            Random rand = new Random((Int32)DateTime.Now.Ticks);
            double begin = rand.NextDouble();

            pointGrid.Measure(new Size(Double.MaxValue, Double.MaxValue));

            DoubleCollection times = Graphics.GenerateDoubleCollection(0, 0.5, 0.75, 1);
            DoubleCollection scaleValues = Graphics.GenerateDoubleCollection(0, 1, 0.5, 1);
            DoubleCollection translateXValues = Graphics.GenerateDoubleCollection(pointGrid.DesiredSize.Width / 2, 0, pointGrid.DesiredSize.Width / 4, 0);
            DoubleCollection translateYValues = Graphics.GenerateDoubleCollection(pointGrid.DesiredSize.Height / 2, 0, pointGrid.DesiredSize.Height / 4, 0);
            List<KeySpline> splines1 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
            List<KeySpline> splines2 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
            List<KeySpline> splines3 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
            List<KeySpline> splines4 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));

            DoubleAnimationUsingKeyFrames xScaleAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, scaleTransform, "(ScaleTransform.ScaleX)", begin + 0.5, times, scaleValues, splines1);
            DoubleAnimationUsingKeyFrames yScaleAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, scaleTransform, "(ScaleTransform.ScaleY)", begin + 0.5, times, scaleValues, splines2);
            DoubleAnimationUsingKeyFrames xTranslateAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, translateTransform, "(TranslateTransform.X)", begin + 0.5, times, translateXValues, splines3);
            DoubleAnimationUsingKeyFrames yTranslateAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, translateTransform, "(TranslateTransform.Y)", begin + 0.5, times, translateYValues, splines4);

            storyboard.Children.Add(xScaleAnimation);
            storyboard.Children.Add(yScaleAnimation);
            storyboard.Children.Add(xTranslateAnimation);
            storyboard.Children.Add(yTranslateAnimation);

            return storyboard;
        }
Пример #26
0
        private void init()
        {
            var list = XmlHelper.LoadFromXml(this.dataFile, typeof(ObservableCollection <Battery>)) as ObservableCollection <Battery>;

            if (list != null)
            {
                this.batteryList = list;
            }

            var config = XmlHelper.LoadFromXml(this.portFile, typeof(PortConfig)) as PortConfig;

            if (config != null)
            {
                this.portConfig = config;
            }

            chart1.Series.Clear();
            var ds = new Visifire.Charts.DataSeries();

            ds.RenderAs     = Visifire.Charts.RenderAs.Column;
            ds.LabelEnabled = true;
            ds.DataPoints.Add(new Visifire.Charts.DataPoint()
            {
                AxisXLabel = "未启动任务", YValue = this.batteryList.Where(i => i.isEnabled == "否").Count()
            });
            ds.DataPoints.Add(new Visifire.Charts.DataPoint()
            {
                AxisXLabel = "已启动任务", YValue = this.batteryList.Where(i => i.isEnabled == "是").Count()
            });
            chart1.Series.Add(ds);

            tbTotal.Text    = this.batteryList.Count.ToString();
            tbDisabled.Text = this.batteryList.Where(i => i.isEnabled == "否").Count().ToString();
            tbEnabled.Text  = this.batteryList.Where(i => i.isEnabled == "是").Count().ToString();
            // 串口配置
            if (this.portConfig != null)
            {
                tbPort.Text    = this.portConfig.serialName;
                tbBitRate.Text = this.portConfig.baudRate;
                tbDataBit.Text = this.portConfig.dataBit;
                tbStopBit.Text = this.portConfig.stopBit;
                tbParity.Text  = this.portConfig.parityBit;
            }
        }
Пример #27
0
        public Bubble3D1()
        {
            InitializeComponent();

             Chart chart = new Chart();

                // Create a new instance of Title
                Title title = new Title();

                // Set title property
                title.Text = "Election Result";

                // Add title to Titles collection
                chart.Titles.Add(title);

                DataPoint dataPoint;
                PhoneApplicationService.Current.State["GetTopEarnerList"] = GetDataByStatesJSONRequest.dataList;
                 getDataList = (List<DataByState>)PhoneApplicationService.Current.State["GetTopEarnerList"];
                    DataSeries dataSeries = new DataSeries();

                // Set DataSeries property
                dataSeries.RenderAs = RenderAs.Bubble;
                   for (int i = 0; i < getDataList.Count; i++)
                {
                    // Create a new instance of DataPoint
                    dataPoint = new DataPoint();

                    // Set YValue for a DataPoint
                    dataPoint.YValue = Convert.ToDouble(getDataList[i].votes);

                        dataPoint.AxisXLabel = getDataList[i].party;

                    // Add dataPoint to DataPoints collection.
                    dataSeries.DataPoints.Add(dataPoint);
                }

                // Add dataSeries to Series collection.
                   chart.Series.Add(dataSeries);

                // Add chart to LayoutRoot
                LayoutRoot.Children.Add(chart);
        }
Пример #28
0
        public void EarningByCategories(string data)
        {
            var categories = Deserializes(data);
            var chart = new Chart {Width = 500, Height = 300, View3D = true};
            chart.Titles.Add(new Title {Text = "Thu nhập theo danh mục"});
            var dataSeries = new DataSeries {RenderAs = RenderAs.Doughnut};

            foreach (var category in categories)
            {
                var dataPoint = new DataPoint
                                    {
                                        YValue = category.Earnings,
                                        AxisXLabel = category.Name,
                                    };
                dataSeries.DataPoints.Add(dataPoint);
            }

            chart.Series.Add(dataSeries);
            LayoutRoot.Children.Clear();
            LayoutRoot.Children.Add(chart);
        }
Пример #29
0
        /// <summary>
        /// Function to create a chart
        /// </summary>
        public void CreateChart()
        {
            // Create a new instance of Chart
            chart = new Chart();

            chart.Watermark = false;

            // Create a new instance of DataSeries
            DataSeries dataSeries = new DataSeries();

            // Set DataSeries property
            dataSeries.RenderAs = RenderAs.Line;
            dataSeries.LineStyle = LineStyles.Solid;
            dataSeries.LineThickness = 3;
            dataSeries.LabelEnabled = false;

            // Create a DataPoint
            DataPoint dataPoint;

            for (int i = 0; i < 10; i++)
            {
                // Create a new instance of DataPoint
                dataPoint = new DataPoint();

                // Set YValue for a DataPoint
                dataPoint.YValue = rand.Next(-100, 100);

                // Add dataPoint to DataPoints collection
                dataSeries.DataPoints.Add(dataPoint);
            }

            // Add dataSeries to Series collection.
            chart.Series.Add(dataSeries);

            // Attach a Loaded event to chart in order to attach a timer's Tick event
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            // Add chart to Chart Grid
            ChartGrid.Children.Add(chart);
        }
Пример #30
0
        public void ExpenseByCategories(string data)
        {
            var categories = Deserializes(data);
            var chart = new Chart {Width = 500, Height = 300, View3D = true};
            chart.Titles.Add(new Title {Text = "Chi tiêu theo danh mục"});
            var dataSeries = new DataSeries {RenderAs = RenderAs.Doughnut};

            foreach (var category in categories)
            {
                var dataPoint = new DataPoint
                {
                    YValue = Math.Abs(category.Expenses),
                    AxisXLabel = category.Name,
                    //Color = BuildBrush(category.ColorHex)
                };
                dataSeries.DataPoints.Add(dataPoint);
            }

            chart.Series.Add(dataSeries);
            LayoutRoot.Children.Clear();
            LayoutRoot.Children.Add(chart);
        }
Пример #31
0
        public void DataSeriesBarChecking()
        {
            Chart chart = new Chart();
            chart.Width = 350;
            chart.Height = 450;
            chart.View3D = true;

            _isLoaded = false;
            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Random rand = new Random();

            DataSeries dataSeries1 = new DataSeries();
            dataSeries1.RenderAs = RenderAs.Bar;

            Int32 numberOfDataPoints = 0;
            Common.AssertAverageDuration(300, 1,
                delegate
                {
                    for (Int32 i = 0; i < 100; i++)
                    {
                        DataPoint dataPoint = new DataPoint();
                        dataPoint.XValue = i + 1;
                        dataPoint.YValue = rand.Next(-500, 500);
                        dataSeries1.DataPoints.Add(dataPoint);
                        numberOfDataPoints++;
                    }
                    chart.Series.Add(dataSeries1);
                });

            Window window = new Window();
            window.Content = chart;
            window.Show();
            if (_isLoaded)
            {
                window.Dispatcher.InvokeShutdown();
                window.Close();
            }
        }
Пример #32
0
        private void AddSeriesToChart(int cjq, Chart c, string fileName)
        {
            string[] fileLines = File.ReadAllLines(fileName);
            c.Series.Clear();

            DataSeries dsPHLJ = new DataSeries();//平滑后的力矩曲线
            dsPHLJ.LegendText = "平滑后的力矩";
            dsPHLJ.Color = oddBrush;

            dsPHLJ.RenderAs = RenderAs.QuickLine;
            c.Series.Add(dsPHLJ);

            int currentindex = 1;
            List<string[]> smoothDataList = Smooth(cjq, fileLines);

            foreach (string[] dataArray in smoothDataList) {
                int index = int.Parse(dataArray[5]);
                if (index > currentindex)
                {
                    currentindex = index;
                    dsPHLJ = new DataSeries();
                    dsPHLJ.ShowInLegend = false;
                    dsPHLJ.RenderAs = RenderAs.QuickLine;
                    if (index % 2 == 0)
                    {
                        dsPHLJ.Color = evenBrush;
                    }
                    else
                    {
                        dsPHLJ.Color = oddBrush;
                    }
                    c.Series.Add(dsPHLJ);
                }
                double time = double.Parse(dataArray[0]);
                DataPoint dpPHLJ = new DataPoint() { YValue = double.Parse(dataArray[2]), XValue = time };
                dsPHLJ.DataPoints.Add(dpPHLJ);
            }
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Map;component/UserInfo.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.tbAge = ((System.Windows.Controls.TextBox)(this.FindName("tbAge")));
     this.tbWeight = ((System.Windows.Controls.TextBox)(this.FindName("tbWeight")));
     this.tbGrade = ((System.Windows.Controls.TextBox)(this.FindName("tbGrade")));
     this.tbStatus = ((System.Windows.Controls.TextBlock)(this.FindName("tbStatus")));
     this.lpGender = ((Microsoft.Phone.Controls.ListPicker)(this.FindName("lpGender")));
     this.tbHeight = ((System.Windows.Controls.TextBox)(this.FindName("tbHeight")));
     this.tbStatusLabel = ((System.Windows.Controls.TextBlock)(this.FindName("tbStatusLabel")));
     this.Rec = ((System.Windows.Shapes.Rectangle)(this.FindName("Rec")));
     this.prgBar = ((System.Windows.Controls.ProgressBar)(this.FindName("prgBar")));
     this.tbTotalCalories = ((System.Windows.Controls.TextBlock)(this.FindName("tbTotalCalories")));
     this.tbTotalDistance = ((System.Windows.Controls.TextBlock)(this.FindName("tbTotalDistance")));
     this.tbLastRun = ((System.Windows.Controls.TextBlock)(this.FindName("tbLastRun")));
     this.tbTotalDuration = ((System.Windows.Controls.TextBlock)(this.FindName("tbTotalDuration")));
     this.tbAvgSpeed = ((System.Windows.Controls.TextBlock)(this.FindName("tbAvgSpeed")));
     this.tbAvgPace = ((System.Windows.Controls.TextBlock)(this.FindName("tbAvgPace")));
     this.Chart = ((Visifire.Charts.Chart)(this.FindName("Chart")));
     this.DataSeries = ((Visifire.Charts.DataSeries)(this.FindName("DataSeries")));
     this.tbCalories = ((System.Windows.Controls.TextBlock)(this.FindName("tbCalories")));
     this.tbDistance = ((System.Windows.Controls.TextBlock)(this.FindName("tbDistance")));
 }
Пример #34
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.buttonDig = ((System.Windows.Controls.Button)(target));

            #line 31 "..\..\KeyDig.xaml"
                this.buttonDig.Click += new System.Windows.RoutedEventHandler(this.btDig);

            #line default
            #line hidden
                return;

            case 2:
                this.buttonExport = ((System.Windows.Controls.Button)(target));

            #line 32 "..\..\KeyDig.xaml"
                this.buttonExport.Click += new System.Windows.RoutedEventHandler(this.btExport);

            #line default
            #line hidden
                return;

            case 3:
                this.sliderGrade = ((System.Windows.Controls.Slider)(target));
                return;

            case 4:
                this.IncludeKey = ((Xceed.Wpf.Toolkit.WatermarkTextBox)(target));
                return;

            case 5:
                this.cbBaidu = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 6:
                this.cb360 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 7:
                this.cbSogou = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 8:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 9:
                this.txtQueryKey = ((Xceed.Wpf.Toolkit.WatermarkTextBox)(target));
                return;

            case 10:
                this.lbDigKey = ((System.Windows.Controls.ListView)(target));

            #line 71 "..\..\KeyDig.xaml"
                this.lbDigKey.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new System.Windows.RoutedEventHandler(this.GridViewColumnHeader_Click));

            #line default
            #line hidden
                return;

            case 11:
                this.gvKey = ((System.Windows.Controls.GridView)(target));
                return;

            case 12:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 13:
                this.ChartTitle = ((Visifire.Charts.Title)(target));
                return;

            case 14:
                this.dataSeries = ((Visifire.Charts.DataSeries)(target));
                return;

            case 15:
                this.Baidu = ((Visifire.Charts.DataPoint)(target));
                return;

            case 16:
                this.So = ((Visifire.Charts.DataPoint)(target));
                return;

            case 17:
                this.Sogou = ((Visifire.Charts.DataPoint)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #35
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tab = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.txtQueryKey = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.cbCondition = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 4:

            #line 35 "..\..\ConditionQuery.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btClear);

            #line default
            #line hidden
                return;

            case 5:
                this.rbOneMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 6:
                this.rbTwoMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 7:
                this.rbThreeMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 8:
                this.Rand10 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 9:
                this.Rand20 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 10:
                this.Rand50 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 11:
                this.Rand100 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 12:
                this.RandCustom = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 13:
                this.iudCustomBDPages = ((Xceed.Wpf.Toolkit.IntegerUpDown)(target));

            #line 61 "..\..\ConditionQuery.xaml"
                this.iudCustomBDPages.GotFocus += new System.Windows.RoutedEventHandler(this.iudCustomBDPages_GotFocus);

            #line default
            #line hidden
                return;

            case 14:
                this.chkSimulation = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 15:

            #line 72 "..\..\ConditionQuery.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btDelDomain);

            #line default
            #line hidden
                return;

            case 16:
                this.chkBaidu = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 17:
                this.chk360 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 18:
                this.chkSogou = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 19:

            #line 85 "..\..\ConditionQuery.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Query);

            #line default
            #line hidden
                return;

            case 20:
                this.tbTotal = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 21:
                this.btReturn = ((System.Windows.Controls.Button)(target));

            #line 101 "..\..\ConditionQuery.xaml"
                this.btReturn.Click += new System.Windows.RoutedEventHandler(this.ReturnQuery);

            #line default
            #line hidden
                return;

            case 22:
                this.btAll = ((System.Windows.Controls.Button)(target));

            #line 109 "..\..\ConditionQuery.xaml"
                this.btAll.Click += new System.Windows.RoutedEventHandler(this.AllResult);

            #line default
            #line hidden
                return;

            case 23:
                this.btExport = ((System.Windows.Controls.Button)(target));

            #line 116 "..\..\ConditionQuery.xaml"
                this.btExport.Click += new System.Windows.RoutedEventHandler(this.ResultExport);

            #line default
            #line hidden
                return;

            case 24:
                this.NowKey = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 25:
                this.tvKey = ((System.Windows.Controls.ListBox)(target));

            #line 138 "..\..\ConditionQuery.xaml"
                this.tvKey.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tvKey_SelectionChanged);

            #line default
            #line hidden
                return;

            case 26:
                this.dgQueryResult = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 27:
                this.wbSimulation = ((System.Windows.Controls.WebBrowser)(target));

            #line 164 "..\..\ConditionQuery.xaml"
                this.wbSimulation.Navigated += new System.Windows.Navigation.NavigatedEventHandler(this.wbSimulation_Navigated);

            #line default
            #line hidden

            #line 164 "..\..\ConditionQuery.xaml"
                this.wbSimulation.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(this.wbSimulation_LoadCompleted);

            #line default
            #line hidden
                return;

            case 28:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 29:
                this.ChartTitle = ((Visifire.Charts.Title)(target));
                return;

            case 30:
                this.dataSeries = ((Visifire.Charts.DataSeries)(target));
                return;

            case 31:
                this.Paiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 32:
                this.noPaiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 33:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #36
0
        void AddSeries(DesignerChartDataSerie newSeries)
        {
            newSeries.DataPoints.CollectionChanged += DataPoints_CollectionChanged;
            DataSeries s = new Visifire.Charts.DataSeries();

            s.Uid = newSeries.Name;


            //线属性
            s.SetBinding(DataSeries.AutoFitToPlotAreaProperty, new Binding("AutoFitToPlotArea")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.AxisXTypeProperty, new Binding("AxisXType")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.AxisYTypeProperty, new Binding("AxisYType")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.BorderColorProperty, new Binding("SeriesBorder.BorderBrush")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.BorderStyleProperty, new Binding("BorderStyle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.BorderThicknessProperty, new Binding("SeriesBorder.BorderThickness")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.ColorProperty, new Binding("Color")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.DataPointsProperty, new Binding("DataPoints")
            {
                Source = newSeries, Converter = (IValueConverter)(new DesignerDataPointCollectionToVisifireDataPointCollectionConverter())
            });
            s.SetBinding(DataSeries.HighLightColorProperty, new Binding("HighLightColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.IncludeDataPointsInLegendProperty, new Binding("IncludeDataPointsInLegend")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.IncludePercentageInLegendProperty, new Binding("IncludePercentageInLegend")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.IncludeYValueInLegendProperty, new Binding("IncludeYValueInLegend")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelBackgroundProperty, new Binding("LabelBackground")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelEnabledProperty, new Binding("LabelEnabled")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelFontColorProperty, new Binding("LabelFont.FontColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelFontFamilyProperty, new Binding("LabelFont.FontFamily")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelFontSizeProperty, new Binding("LabelFont.FontSize")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelFontStyleProperty, new Binding("LabelFont.FontStyle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelFontWeightProperty, new Binding("LabelFont.FontWeight")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelLineColorProperty, new Binding("LabelLineColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelLineEnabledProperty, new Binding("LabelLineEnabled")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelLineStyleProperty, new Binding("LabelLineStyle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelLineThicknessProperty, new Binding("LabelLineThickness")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelStyleProperty, new Binding("LabelStyle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelTextProperty, new Binding("LabelText")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LegendMarkerColorProperty, new Binding("LegendMarkerColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LegendMarkerTypeProperty, new Binding("LegendMarkerType")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LegendTextProperty, new Binding("LegendText")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LightingEnabledProperty, new Binding("LightingEnabled")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LineCapProperty, new Binding("LineCap")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LineFillProperty, new Binding("LineFill")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LineStyleProperty, new Binding("LineStyle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LineTensionProperty, new Binding("LineTension")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LineThicknessProperty, new Binding("LineThickness")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerBorderColorProperty, new Binding("MarkerBorderColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerBorderThicknessProperty, new Binding("MarkerBorderThickness")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerColorProperty, new Binding("MarkerColor")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerEnabledProperty, new Binding("MarkerEnabled")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerScaleProperty, new Binding("MarkerScale")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerSizeProperty, new Binding("MarkerSize")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.MarkerTypeProperty, new Binding("MarkerType")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.RadiusXProperty, new Binding("RadiusX")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.RadiusYProperty, new Binding("RadiusY")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.RenderAsProperty, new Binding("RenderAs")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.ShadowEnabledProperty, new Binding("ShadowEnabled")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.ShowInLegendProperty, new Binding("ShowInLegend")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.LabelAngleProperty, new Binding("LabelAngle")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.XValueTypeProperty, new Binding("XValueType")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });
            s.SetBinding(DataSeries.ZIndexProperty, new Binding("ZIndex")
            {
                Source = newSeries, Mode = BindingMode.OneWay
            });



            Chart uChart = this.Content as Chart;

            if (uChart.Series == null)
            {
                uChart.Series = new DataSeriesCollection();
            }
            if (!uChart.Series.Contains(s))
            {
                uChart.Series.Add(s);
            }
        }
Пример #37
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tab = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.chkBaidu = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 3:
                this.chk360 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 4:
                this.txtQueryKey = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.Rand10 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 6:
                this.Rand20 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 7:
                this.Rand50 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 8:
                this.Rand100 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 9:

            #line 47 "..\..\PlatformQuery.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btQuery);

            #line default
            #line hidden
                return;

            case 10:
                this.tbTotal = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:

            #line 64 "..\..\PlatformQuery.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ReturnQuery);

            #line default
            #line hidden
                return;

            case 12:
                this.tvKey = ((System.Windows.Controls.ListBox)(target));

            #line 84 "..\..\PlatformQuery.xaml"
                this.tvKey.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tvKey_SelectionChanged);

            #line default
            #line hidden
                return;

            case 13:
                this.dgQueryResult = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 14:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 15:
                this.ChartTitle = ((Visifire.Charts.Title)(target));
                return;

            case 16:
                this.dataSeries = ((Visifire.Charts.DataSeries)(target));
                return;

            case 17:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #38
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\..\Report\N2_Report.xaml"
                ((EMS.Report.N2_Report)(target)).Unloaded += new System.Windows.RoutedEventHandler(this.UserControl_Unloaded);

            #line default
            #line hidden
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.gd_output = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.dp_date = ((Microsoft.Windows.Controls.DatePicker)(target));
                return;

            case 5:
                this.btn_search = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\..\..\Report\N2_Report.xaml"
                this.btn_search.Click += new System.Windows.RoutedEventHandler(this.btn_search_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 7:
                this.PV = ((Visifire.Charts.DataSeries)(target));
                return;

            case 8:
                this.SV = ((Visifire.Charts.DataSeries)(target));
                return;

            case 9:
                this.txt_currentHumidity = ((System.Windows.Controls.TextBox)(target));
                return;

            case 10:
                this.txt_refreshTime = ((System.Windows.Controls.TextBox)(target));
                return;

            case 11:
                this.txt_highLimit = ((System.Windows.Controls.TextBox)(target));
                return;

            case 12:
                this.txt_LowLimit = ((System.Windows.Controls.TextBox)(target));
                return;

            case 13:
                this.Inventory_Pie = ((System.Windows.Controls.WrapPanel)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #39
0
        public Chart CreateChart(Stock stock)
        {
            Visifire.Charts.Chart visiChart = new Visifire.Charts.Chart();
            Visifire.Charts.Title title     = new Visifire.Charts.Title();

            title.Text = stock.Name;
            visiChart.Titles.Add(title);

            visiChart.Width  = 300;
            visiChart.Height = 200;

            Visifire.Charts.DataSeries dataSeriesClose = new Visifire.Charts.DataSeries();
            Visifire.Charts.DataSeries dataSeriesOpen  = new Visifire.Charts.DataSeries();
            Visifire.Charts.DataSeries dataSeriesLow   = new Visifire.Charts.DataSeries();
            Visifire.Charts.DataSeries dataSeriesHigh  = new Visifire.Charts.DataSeries();


            Visifire.Charts.DataPoint dataPointClose;
            Visifire.Charts.DataPoint dataPointOpen;
            Visifire.Charts.DataPoint dataPointLow;
            Visifire.Charts.DataPoint dataPointHigh;

            foreach (var stockVal in stock.values)
            {
                if (stockVal.Open.HasValue)
                {
                    dataPointOpen        = new DataPoint();
                    dataPointOpen.YValue = stockVal.Open.Value;
                    dataSeriesOpen.DataPoints.Add(dataPointOpen);
                }
                if (stockVal.High.HasValue)
                {
                    dataPointHigh        = new DataPoint();
                    dataPointHigh.YValue = stockVal.High.Value;
                    dataSeriesHigh.DataPoints.Add(dataPointHigh);
                }
                if (stockVal.Close.HasValue)
                {
                    dataPointClose        = new DataPoint();
                    dataPointClose.YValue = stockVal.Close.Value;
                    dataSeriesClose.DataPoints.Add(dataPointClose);
                }
                if (stockVal.Low.HasValue)
                {
                    dataPointLow        = new DataPoint();
                    dataPointLow.YValue = stockVal.Low.Value;
                    dataSeriesLow.DataPoints.Add(dataPointLow);
                }
            }

            if (dataSeriesLow.DataPoints.Count > 0)
            {
                dataSeriesLow.RenderAs = RenderAs.Line;
                dataSeriesLow.Name     = "Low";
                visiChart.Series.Add(dataSeriesLow);
            }
            if (dataSeriesHigh.DataPoints.Count > 0)
            {
                dataSeriesHigh.RenderAs = RenderAs.Line;
                dataSeriesHigh.Name     = "High";
                visiChart.Series.Add(dataSeriesHigh);
            }
            if (dataSeriesOpen.DataPoints.Count > 0)
            {
                dataSeriesOpen.RenderAs = RenderAs.Line;
                dataSeriesOpen.Name     = "Open";
                visiChart.Series.Add(dataSeriesOpen);
            }
            if (dataSeriesClose.DataPoints.Count > 0)
            {
                dataSeriesClose.RenderAs = RenderAs.Line;
                dataSeriesClose.Name     = "Close";
                visiChart.Series.Add(dataSeriesClose);
            }
            return(visiChart);
        }
Пример #40
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tab = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.txtQueryKey = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.cbCondition = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 4:

            #line 34 "..\..\LinksExtracted.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btClear);

            #line default
            #line hidden
                return;

            case 5:
                this.rbOneMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 6:
                this.rbTwoMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 7:
                this.Rand10 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 8:
                this.Rand20 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 9:
                this.Rand50 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 10:
                this.Rand100 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 11:

            #line 57 "..\..\LinksExtracted.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Query);

            #line default
            #line hidden
                return;

            case 12:
                this.tbTotal = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.tbInclude = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 14:
                this.tbIncludeRate = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:

            #line 76 "..\..\LinksExtracted.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ReturnQuery);

            #line default
            #line hidden
                return;

            case 16:
                this.tvKey = ((System.Windows.Controls.ListBox)(target));

            #line 97 "..\..\LinksExtracted.xaml"
                this.tvKey.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tvKey_SelectionChanged);

            #line default
            #line hidden
                return;

            case 17:
                this.dgQueryResult = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 18:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 19:
                this.ChartTitle = ((Visifire.Charts.Title)(target));
                return;

            case 20:
                this.dataSeries = ((Visifire.Charts.DataSeries)(target));
                return;

            case 21:
                this.Paiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 22:
                this.noPaiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 23:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #41
0
        /// <summary>
        /// Metodo de graficación.
        /// </summary>
        /// <returns></returns>
        public Chart Draw(params string[] filtros)
        {
            // Create a new instance of Chart
            Chart chart = new Chart();

            chart.AnimationEnabled = true;
            // Create a new instance of Title
            Title title = new Title();
            // Set title property
            title.Text = "Efectividad MDZ";
            // Add title to Titles collection
            chart.Titles.Add(title);
            // Create a new instance of DataSeries
            DataSeries dataSeries = new DataSeries();
            // Set DataSeries property
            dataSeries.RenderAs = RenderAs.Line;
            #region configuracion eje X
            // Creating AxisX
            Axis axisX = new Axis();
            // Date time standard format
            axisX.ValueFormatString = "000000";
            // To avoid auto skip

            chart.AxesX.Add(axisX);
            #endregion
            // Create a DataPoint
            DataPoint dataPoint;
            #region consulta
            DataTable kpis;
            try
            {
                kpis = new DataTable();
                Consultas consulta = new Consultas();
                kpis = consulta.SelectKPI_EfectividadMDZ(filtros).Tables[0];
                consulta = null;
                string serAnt = "-5555";
                string ser = "-1111";
                foreach (DataRow g in kpis.Rows)
                {
                    Decimal? y = g["EfectivenessByBrand"]!=DBNull.Value?(Decimal?)g["EfectivenessByBrand"]:null;
                    long x = (long)g["TimeId"];
                    ser = (string)g["ProductSubfamilyDescription"];
                    //Creando las series
                    if (serAnt != ser)
                    {
                        if (serAnt != "-5555")
                        {
                            chart.Series.Add(dataSeries);
                        }
                        // Create a new instance of DataSeries
                        dataSeries = new DataSeries();
                        dataSeries.Name = ser;
                        // Set DataSeries property
                        dataSeries.RenderAs = RenderAs.Line;
                        dataSeries.MarkerType = Visifire.Commons.MarkerTypes.Circle;
                        dataSeries.SelectionEnabled = true;
                        dataSeries.LineThickness = 3;

                    }
                    // Create a new instance of DataPoint
                    dataPoint = new DataPoint();
                    // Set YValue for a DataPoint
                    if (x != null) dataPoint.AxisXLabel = x.ToString();
                    if (!ciclos.Contains(x.ToString()))  ciclos.Add(x.ToString());
                    dataPoint.YValue = System.Convert.ToDouble(y);
                    // Add dataPoint to DataPoints collection.
                    dataSeries.DataPoints.Add(dataPoint);
                    serAnt = ser;
                }
            }
            catch (Exception Error)
            {
                throw (new Exception(Error.ToString()));
            }
            #endregion
            // Add dataSeries to Series collection.
            chart.Series.Add(dataSeries);
            return chart;
        }
Пример #42
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tab = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.txtQueryKey = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.cbCondition = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 4:

            #line 35 "..\..\CreativeCollection.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btClear);

            #line default
            #line hidden
                return;

            case 5:
                this.rbNameMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 6:
                this.rbDomainMode = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 7:
                this.chkLeftRank = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 8:
                this.chkRightRank = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 9:
                this.iudRefreshNum = ((Xceed.Wpf.Toolkit.IntegerUpDown)(target));
                return;

            case 10:

            #line 66 "..\..\CreativeCollection.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btDelDomain);

            #line default
            #line hidden
                return;

            case 11:
                this.chkBaidu = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 12:
                this.chk360 = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 13:
                this.chkSogou = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 14:

            #line 79 "..\..\CreativeCollection.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Query);

            #line default
            #line hidden
                return;

            case 15:
                this.tbTotal = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 16:
                this.btReturn = ((System.Windows.Controls.Button)(target));

            #line 95 "..\..\CreativeCollection.xaml"
                this.btReturn.Click += new System.Windows.RoutedEventHandler(this.ReturnQuery);

            #line default
            #line hidden
                return;

            case 17:
                this.btAll = ((System.Windows.Controls.Button)(target));

            #line 103 "..\..\CreativeCollection.xaml"
                this.btAll.Click += new System.Windows.RoutedEventHandler(this.AllResult);

            #line default
            #line hidden
                return;

            case 18:
                this.btExport = ((System.Windows.Controls.Button)(target));

            #line 110 "..\..\CreativeCollection.xaml"
                this.btExport.Click += new System.Windows.RoutedEventHandler(this.ResultExport);

            #line default
            #line hidden
                return;

            case 19:
                this.NowKey = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.tvKey = ((System.Windows.Controls.ListBox)(target));

            #line 132 "..\..\CreativeCollection.xaml"
                this.tvKey.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tvKey_SelectionChanged);

            #line default
            #line hidden
                return;

            case 21:
                this.dgQueryResult = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 22:
                this.MyChart = ((Visifire.Charts.Chart)(target));
                return;

            case 23:
                this.ChartTitle = ((Visifire.Charts.Title)(target));
                return;

            case 24:
                this.dataSeries = ((Visifire.Charts.DataSeries)(target));
                return;

            case 25:
                this.Paiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 26:
                this.noPaiming = ((Visifire.Charts.DataPoint)(target));
                return;

            case 27:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }