예제 #1
0
        public void TestToolTipSerialization()
        {
            Chart chart = new Chart();

            chart.Width  = 400;
            chart.Height = 300;

            _isLoaded = false;

            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Visifire.Charts.ToolTip toolTip = new Visifire.Charts.ToolTip();
            toolTip.FontColor = new SolidColorBrush(Colors.Aqua);
            chart.ToolTips.Add(toolTip);

            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(toolTip));
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
예제 #2
0
파일: ChartTest.cs 프로젝트: tdhieu/openvss
        public void TestToolTipSerialization()
        {
            Chart chart = new Chart();
            chart.Width = 400;
            chart.Height = 300;

            _isLoaded = false;

            chart.Loaded += new RoutedEventHandler(chart_Loaded);

            Visifire.Charts.ToolTip toolTip = new Visifire.Charts.ToolTip();
            toolTip.FontColor = new SolidColorBrush(Colors.Aqua);
            chart.ToolTips.Add(toolTip);

            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(toolTip));
            }

            window.Dispatcher.InvokeShutdown();
            window.Close();
        }
예제 #3
0
        public void BindChart(List <WealthyInfo> WealthyList, string type)
        {
            this.WealthyList1 = WealthyList;
            #region 设置控件基础属性
            Chart chart = new Chart();
            chart.Width  = 400;
            chart.Height = 350;
            chart.Name   = "Chart";
            chart.SetValue(Canvas.LeftProperty, 30.0);
            chart.SetValue(Canvas.TopProperty, 30.0);
            chart.Theme          = "Theme1";//设置皮肤
            chart.BorderBrush    = new SolidColorBrush(Colors.Gray);
            chart.AnimatedUpdate = true;
            chart.CornerRadius   = new CornerRadius(7);
            chart.ShadowEnabled  = true;
            chart.Padding        = new Thickness(4, 4, 4, 10);
            #endregion

            #region 设置Title
            Title title = new Title();
            title.Text = type == "a"? "压铸车间产能统计": "机加车间月份产能";
            chart.Titles.Add(title);
            #endregion

            #region 设置AxesX
            Axis xAxis = new Axis();
            xAxis.Title = "所有月份";
            chart.AxesX.Add(xAxis);
            #endregion

            #region 设置AxesY
            Axis yAxis = new Axis();
            yAxis.Title  = type == "a" ? "压铸车间" : "机加车间";
            yAxis.Prefix = "数量:";
            yAxis.Suffix = "个";
            chart.AxesY.Add(yAxis);
            #endregion

            #region 设置PlotArea
            PlotArea plot = new PlotArea();
            plot.ShadowEnabled = false;
            chart.PlotArea     = plot;
            #endregion

            #region 设置Legends
            Legend legend = new Legend();
            legend.MouseLeftButtonDown += Legend_MouseLeftButtonDown;
            chart.Legends.Add(legend);
            #endregion
            #region
            Visifire.Charts.ToolTip tip = new Visifire.Charts.ToolTip();
            tip.VerticalAlignment = VerticalAlignment.Bottom;
            chart.ToolTips.Add(tip);
            #endregion
            #region 创建数据序列和数据点

            foreach (WealthyInfo cominfo in WealthyList)
            {
                DataSeries dseries = new DataSeries();
                dseries.RenderAs   = RenderAs.StackedColumn;
                dseries.LegendText = cominfo.ProductName;

                DataPoint dpointUpload = new DataPoint();
                dpointUpload.YValue = cominfo.AmountIncomeMoney;
                dpointUpload.Tag    = cominfo.ProductName;
                dpointUpload.MouseLeftButtonDown += Dpoint_MouseLeftButtonDown;
                dseries.DataPoints.Add(dpointUpload);
                chart.Series.Add(dseries);
            }
            #endregion
            LayoutRoot.Children.Add(chart);
            //LayoutRoot.Children.Add(chart2);
        }