Ejemplo n.º 1
0
        /// <summary>
        ///     Data
        /// </summary>
        /// <param name="Names">List of strings.</param>
        /// <returns name="Data">Data</returns>
        public static LegendData Data(
            List <string> Names)
        {
            LegendData data = new LegendData();

            data.Data = Names;

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Data
        /// </summary>
        /// <param name="Names">List of strings.</param>
        /// <returns name="Data">Data</returns>
        public static LegendData Data(
            List <string> Names)
        {
            LegendData data = new LegendData();

            data.Data = new JavaScriptSerializer().Serialize(Names);

            return(data);
        }
Ejemplo n.º 3
0
        public void ReadFile(string filename)
        {
            // Get each line of file as an entry in array lines.
            string[] lines = File.ReadAllLines(Utils.GetLevelFilePath(filename));

            // Iterate over lines and add data till the corresponding field
            // Adds tiles to MapData
            for (var i = 0; i < 24; i++)
            {
                foreach (var j in lines[i])
                {
                    MapData.Add(j);
                }
            }


            foreach (var i in lines)
            {
                if (i.StartsWith("Platforms"))
                {
                    var platforms = i.Split(':')[1].Split(',');
                    foreach (var j in platforms)
                    {
                        var elm      = lines.Where(el => el.StartsWith(j.Trim() + ") "));
                        var charKey  = elm.First().Split(' ', ')')[0].ToCharArray()[0];
                        var strValue = elm.First().Split(' ')[1];
                        MetaData.Add(charKey, strValue);
                    }
                }

                if (i.Contains(")"))
                {
                    char   charKey  = i.Split(')')[0][0];
                    string strValue = i.Split(')')[1].Trim();
                    LegendData.Add(charKey, strValue);
                }

                if (i.StartsWith("Customer"))
                {
                    var customers = i.Split(':')[1].Split(' ');
                    CustomerData.Add(customers);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     Legend
 /// </summary>
 /// <param name="Data">Legend Data</param>
 /// <param name="Style">Legend Style</param>
 /// <returns name="legend">Legend object.</returns>
 public static D3jsLib.Legend.Legend Create(LegendData Data, LegendStyle Style)
 {
     D3jsLib.Legend.Legend chart = new D3jsLib.Legend.Legend(Data, Style);
     return(chart);
 }
Ejemplo n.º 5
0
        public void Update(Boolean useTransition)
        {
            LegendAreaWidth = 0;
            D3Data          = new Data()
            {
                List = Data.Select(d => d as Object).ToList()
            };

            firstColumnViewModel  = Data[0].ColumnViewModel;
            secondColumnViewModel = Data[0].Children[0].ColumnViewModel;

            // chart data 수정
            ChartData   = Data.SelectMany(d => d.Children).ToList();
            D3ChartData = new Data()
            {
                List = ChartData.Select(d => d as Object).ToList()
            };

            /*
             *  기존 데이터를 여러 각도로 수정해야함
             *  1. 레전드용 데이터: 두번째 키만 모아야함. 이것은 색깔을 배치할때도 쓰임
             *  2. 사각형 그리기용 데이터: 왜냐하면 hierarchical하게 있으면 안되므로
             */

            // legend 데이터 수정

            if (LegendVisibility == Visibility.Visible)
            {
                LegendData.Clear();
                foreach (GroupedBarChartDatum gbcd in Data)
                {
                    foreach (BarChartDatum bcd in gbcd.Children)
                    {
                        if (LegendData.Select(d => d.Key).Count(d => d == bcd.Key) == 0)
                        {
                            LegendData.Add(bcd);
                        }
                    }
                }

                LegendData = LegendData.OrderBy(d => d.Order).ToList();

                LegendRectangleElement.Data = new Data()
                {
                    List = LegendData.Select(d => d as Object).ToList()
                };
                LegendRectangleElement.Update(useTransition ? TransitionType.Opacity : TransitionType.None);

                LegendTextElement.Data = new Data()
                {
                    List = LegendData.Select(d => d as Object).ToList()
                };
                LegendTextElement.Update(useTransition ? TransitionType.Opacity : TransitionType.None);
                LegendTextElement.ForceMeasure();

                LegendAreaWidth          = Math.Max(LegendTextElement.MaxActualWidth + Const.LegendPatchWidth + Const.LegendPatchSpace + Const.PaddingRight, Const.MinimumLegendWidth);
                LegendTitleElement.Width = LegendAreaWidth;
                LegendTitleElement.Text  = LegendTitle;
                Canvas.SetTop(LegendTitleElement, LegendPatchYGetter(null, 0) - 30);
            }

            Canvas.SetLeft(LegendPanel, this.Width - LegendAreaWidth);

            if (HorizontalAxisVisibility == Visibility.Visible)
            {
                ChartAreaEndY = this.Height - Const.PaddingBottom - Const.HorizontalAxisHeight - Const.HorizontalAxisLabelHeight;
            }
            else
            {
                ChartAreaEndY = this.Height - Const.PaddingBottom;
            }

            if (LegendVisibility == Visibility.Visible)
            {
                ChartAreaEndX = this.Width - Const.PaddingRight - LegendAreaWidth;
            }
            else
            {
                ChartAreaEndX = this.Width - Const.PaddingRight;
            }

            HorizontalAxisLabelCanvasLeft = Const.PaddingLeft + Const.VerticalAxisWidth + Const.VerticalAxisLabelWidth;
            HorizontalAxisLabelCanvasTop  = ChartAreaEndY + Const.HorizontalAxisHeight;
            HorizontalAxisLabelWidth      = ChartAreaEndX - Const.PaddingLeft - Const.VerticalAxisWidth - Const.VerticalAxisLabelWidth;

            VerticalAxisCanvasLeft      = Const.PaddingLeft + Const.VerticalAxisLabelWidth + Const.VerticalAxisWidth;
            VerticalAxisLabelCanvasLeft = Const.PaddingLeft + Const.VerticalAxisLabelWidth / 2 - (ChartAreaEndY - Const.PaddingTop) / 2;
            VerticalAxisLabelCanvasTop  = Const.PaddingTop + (ChartAreaEndY - Const.PaddingTop) / 2;
            VerticalAxisLabelHeight     = ChartAreaEndY - Const.PaddingTop;

            isSelectionEnabled = ChartData.Any(bcd => bcd.BarState == BarState.FullySelected || bcd.BarState == BarState.PartiallySelected);

            // 최솟 최댓값 모두 envelope의 값은 고려해야함
            // 그냥 값은 선택되어 있을때만 고려해야함
            Double yMin = ChartData.Select(d => d.EnvelopeValue).Min(),
                   yMax = ChartData.Select(d => d.EnvelopeValue).Max();

            if (isSelectionEnabled) // 선택된게 하나라도 있으면
            {
                IEnumerable <Double> selected = ChartData.Where(cd => cd.BarState == BarState.FullySelected || cd.BarState == BarState.PartiallySelected).Select(cd => cd.Value);
                yMin = Math.Min(yMin, selected.Min());
                yMax = Math.Max(yMax, selected.Max());
            }

            if (YStartsFromZero)
            {
                yMin = 0;
            }
            else if (yMin == yMax)
            {
                if (yMin == 0.0)
                {
                    yMin = -1; yMax = 1;
                }
                else if (yMin < 0)
                {
                    yMin *= 1.2;
                    yMax *= 0.8;
                }
                else
                {
                    yMin *= 0.8;
                    yMax *= 1.2;
                }
            }
            else
            {
                if (yMin > 0)
                {
                    yMin *= 0.9;
                }
                else
                {
                    yMin *= 1.1;
                }
            }

            YScale = new Linear()
            {
                DomainStart = yMin,
                DomainEnd   = yMax,
                RangeStart  = ChartAreaEndY,
                RangeEnd    = Const.PaddingTop
            };

            YScale.Nice();

            XScale = new Ordinal()
            {
                RangeStart = VerticalAxisCanvasLeft,
                RangeEnd   = ChartAreaEndX + Const.PaddingLeft
            };

            foreach (GroupedBarChartDatum datum in Data)
            {
                XScale.Domain.Add(datum);
            }

            MaxBarCountInAGroup = Data.Select(d => d.Children.Count()).Max();


            // update 시 재대입 할 것들 대입

            HandleRectangleElement.Data   = D3ChartData;
            EnvelopeRectangleElement.Data = D3ChartData;
            RectangleElement.Data         = D3ChartData;

            HorizontalAxis.Scale = XScale;
            Canvas.SetTop(HorizontalAxis, ChartAreaEndY);
            HorizontalAxis.Visibility = HorizontalAxisVisibility;

            Canvas.SetTop(HorizontalAxisTitleElement, HorizontalAxisLabelCanvasTop);
            Canvas.SetLeft(HorizontalAxisTitleElement, HorizontalAxisLabelCanvasLeft);
            HorizontalAxisTitleElement.Width      = HorizontalAxisLabelWidth;
            HorizontalAxisTitleElement.Visibility = HorizontalAxisVisibility;
            HorizontalAxisTitleElement.Text       = HorizontalAxisTitle;

            VerticalAxis.Scale = YScale;
            Canvas.SetLeft(VerticalAxis, VerticalAxisCanvasLeft);

            Canvas.SetTop(VerticalAxisTitleElement, VerticalAxisLabelCanvasTop);
            Canvas.SetLeft(VerticalAxisTitleElement, VerticalAxisLabelCanvasLeft);
            VerticalAxisTitleElement.Width = VerticalAxisLabelHeight;
            VerticalAxisTitleElement.Text  = VerticalAxisTitle;

            LegendHandleRectangleElement.Data = new Data()
            {
                List = LegendData.Select(d => d as Object).ToList()
            };
            LegendHandleRectangleElement.Visibility = LegendVisibility;

            LegendRectangleElement.Data = new Data()
            {
                List = LegendData.Select(d => d as Object).ToList()
            };
            LegendRectangleElement.Visibility = LegendVisibility;

            LegendTextElement.Data = new Data()
            {
                List = LegendData.Select(d => d as Object).ToList()
            };
            LegendTextElement.Visibility = LegendVisibility;

            IndicatorTextElement.Data = new Data()
            {
                List = ChartData.Select(d => d as Object).ToList()
            };

            LegendHandleRectangleElement.Update(useTransition ? TransitionType.Opacity : TransitionType.None);
            HandleRectangleElement.Update(TransitionType.None);
            EnvelopeRectangleElement.Update(useTransition ? TransitionType.All : TransitionType.None);
            RectangleElement.Update(useTransition ? TransitionType.All : TransitionType.None);
            IndicatorTextElement.Update(useTransition ? TransitionType.All : TransitionType.None);
            HorizontalAxis.Update(useTransition);
            VerticalAxis.Update(useTransition);
        }
Ejemplo n.º 6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DataTable table = (DataTable)ViewState["CloneTable"];

            if (table == null)
            {
                MessageBox.Show(this, "数据表不存在!");
                return;
            }
            if (table.Rows.Count < 3)
            {
                MessageBox.Show(this, "不能低于3条数据!");
                return;
            }
            string customerId = this.ddlCustomer.SelectedValue;
            string chartTitle = this.txtChartTitle.Text.Trim().Replace("#", "");

            try
            {
                var               missing     = Type.Missing;
                string            fileName    = Server.MapPath("~/template_files/template_workbook.xlsx");
                Excel.Application application = new Excel.Application();
                application.Visible       = false;
                application.DisplayAlerts = false;
                Excel.Workbook workbook = application.Workbooks.Open(fileName);

                string           SheetName = "sheet1";
                Excel._Worksheet worksheet = workbook.Sheets[SheetName];
                worksheet.Activate();

                //写入Excel列头
                int i            = 0;
                int columnsCount = table.Columns.Count;
                for (int j = 0; j < columnsCount; j++)
                {
                    if (j > 1)
                    {
                        i++;
                        var         letter = CommonUtility.GetLetters()[i];
                        Excel.Range range  = worksheet.get_Range(letter + "1");
                        range.Value2 = table.Columns[j].ColumnName;
                    }
                }
                //写入Excel数据
                int a = 1;
                foreach (DataRow row in table.Rows)
                {
                    a++;
                    for (int b = 1; b < columnsCount; b++)
                    {
                        Excel.Range range = worksheet.get_Range(CommonUtility.GetLetters()[b - 1] + a);
                        range.Value2 = row[b].ToString();
                    }
                }


                Excel.Shape shape1 = worksheet.Shapes.AddChart(Excel.XlChartType.xlLine, missing, missing, missing, missing);

                Excel.Range sourceRange = worksheet.get_Range("A1", CommonUtility.GetLetters()[columnsCount - 2] + a);

                //设置数据源
                shape1.Chart.SetSourceData(sourceRange, missing);

                //设置标题
                shape1.Chart.HasTitle        = true;
                shape1.Chart.ChartTitle.Text = chartTitle;
                shape1.Chart.ChartTitle.Format.TextFrame2.TextRange.Font.Size = 16;

                Excel.Series se = shape1.Chart.SeriesCollection(1);
                se.Format.Line.Visible      = MsoTriState.msoTrue;
                se.Format.Line.Transparency = 0.0f;
                se.Format.Line.Weight       = 2.25f;

                se = shape1.Chart.SeriesCollection(2);
                se.Format.Line.ForeColor.RGB = Color.FromArgb(0, 0, 192).ToArgb();
                se.Format.Line.Visible       = MsoTriState.msoTrue;
                se.Format.Line.Transparency  = 0.0f;
                se.Format.Line.Weight        = 2.25f;

                shape1.Left               = (float)worksheet.get_Range("G1").Left;
                shape1.Top                = (float)worksheet.get_Range("G8").Top;
                shape1.Fill.Visible       = MsoTriState.msoTrue;
                shape1.Fill.ForeColor.RGB = Color.FromArgb(225, 236, 238).ToArgb();
                shape1.Fill.Transparency  = 0;
                shape1.Fill.Solid();
                shape1.Chart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionBottom;
                shape1.Chart.PlotArea.Format.Fill.Visible       = MsoTriState.msoTrue;
                shape1.Chart.PlotArea.Format.Fill.ForeColor.RGB = Color.FromArgb(218, 234, 253).ToArgb();
                shape1.Chart.PlotArea.Format.Fill.Transparency  = 0;
                shape1.Chart.PlotArea.Format.Fill.Solid();

                DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath("~/Download/" + this.ddlCustomer.SelectedItem.Text));
                if (!directoryInfo.Exists)
                {
                    directoryInfo.Create();
                }
                String ymd = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
                string saveExcelFileName = String.Format("{0}_{1}.xlsx", chartTitle, ymd);
                string saveExcelFilePath = Path.Combine(directoryInfo.FullName, saveExcelFileName);
                string savePngFileName   = String.Format("{0}_{1}.png", chartTitle, ymd);
                string savePngFilePath   = Path.Combine(directoryInfo.FullName, savePngFileName);
                string excelFileName     = "/Download/" + this.ddlCustomer.SelectedItem.Text + "/" + saveExcelFileName;
                string pngFileName       = "/Download/" + this.ddlCustomer.SelectedItem.Text + "/" + savePngFileName;
                worksheet.SaveAs(saveExcelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
                shape1.Chart.Export(savePngFilePath, missing, missing);

                application.Quit();
                worksheet   = null;
                workbook    = null;
                application = null;
                GC.GetTotalMemory(false);
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.GetTotalMemory(true);
                using (var context = new ChartContext())
                {
                    var entity = new Gather
                    {
                        CustomerID    = int.Parse(customerId),
                        TimeRange     = "",
                        ChartTitle    = chartTitle,
                        ExcelFilePath = excelFileName,
                        PngFilePath   = pngFileName,
                        AddDate       = DateTime.Now,
                        Flag          = "trendCompare"
                    };
                    StringBuilder sBuilder = new StringBuilder();
                    foreach (ListItem item in this.lstCategories.Items)
                    {
                        sBuilder.AppendFormat("{0},", item.Value);
                    }
                    string legendString = sBuilder.ToString().TrimEnd(',');
                    Legend legend       = new Legend()
                    {
                        LegendName = legendString
                    };
                    entity.Legends.Add(legend);

                    StringBuilder legendDataBuilder = new StringBuilder();
                    foreach (DataRow row in table.Rows)
                    {
                        for (int c = 0; c < table.Columns.Count; c++)
                        {
                            if (c > 0)
                            {
                                if (c == 1)
                                {
                                    legendDataBuilder.AppendFormat("{0}+", row[c].ToString());
                                }
                                else
                                {
                                    legendDataBuilder.AppendFormat("{0},", row[c].ToString());
                                }
                            }
                        }
                        legendDataBuilder.Append("|");
                    }
                    string strValue = legendDataBuilder.ToString().TrimEnd('|');
                    foreach (string str in strValue.Split('|'))
                    {
                        LegendData legendData = new LegendData()
                        {
                            DateString  = str.TrimEnd(',').Split('+')[0],
                            LegendValue = str.TrimEnd(',').Split('+')[1]
                        };
                        legend.LegendDatas.Add(legendData);
                    }
                    context.Gathers.Add(entity);
                    context.SaveChanges();
                }

                using (FileStream fileStream = new FileStream(saveExcelFilePath, FileMode.Open))
                {
                    byte[] bytes = fileStream.ToByteArray();
                    Response.Clear();
                    Response.AddHeader("Content-Length", fileStream.Length.ToString());
                    Response.ContentType = "application/ms-excel";
                    Response.AddHeader("Content-Disposition", "inline;FileName=" + saveExcelFileName);
                    fileStream.Close();
                    fileStream.Dispose();
                    Response.BinaryWrite(bytes);
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 组件初始化
        /// </summary>
        /// <param name="option"></param>
        private void OptionComponent(Option option)
        {
            EChartsComponentTitle title = new EChartsComponentTitle {
                Text = "hello World", Subtext = "UglyMelon007"
            };

            option.Title = title;

            EChartsComponentTooltip tooltip = new EChartsComponentTooltip {
                Trigger = "axis"
            };

            option.Tooltip = tooltip;

            EChartsComponentLegend legend     = new EChartsComponentLegend();
            LegendData             legendData = new LegendData {
                Name = "最高温度"
            };

            legend.Data   = new[] { legendData };
            option.Legend = legend;

            EChartsComponentAxis xAxis = new EChartsComponentAxis {
                Type = "category", BoundaryGap = "false"
            };

            xAxis.Data = new[] {
                new AxisData {
                    Value = "Monday"
                },
                new AxisData {
                    Value = "Tuesday"
                },
                new AxisData {
                    Value = "Wednesday"
                },
                new AxisData {
                    Value = "Thursday"
                },
                new AxisData {
                    Value = "Friday"
                },
                new AxisData {
                    Value = "Saturday"
                },
                new AxisData {
                    Value = "Sunday"
                }
            };
            option.XAxis = xAxis;

            EChartsComponentAxis yAxis = new EChartsComponentAxis {
                Type = "value"
            };
            AxisLabel axisLabel = new AxisLabel {
                Formatter = "{value} °C"
            };

            yAxis.AxisLabel = axisLabel;
            option.YAxis    = yAxis;

            EChartsComponentToolbox toolbox = new EChartsComponentToolbox();

            toolbox.Show = "true";
            Feature feature = new Feature();
            Mark    mark    = new Mark {
                Show = "true"
            };
            DataView dataView = new DataView {
                Show = "true", ReadOnly = "false"
            };
            MagicType magicType = new MagicType {
                Show = "true", Type = new[] { "line", "bar" }
            };
            Restore restore = new Restore {
                Show = "true"
            };
            SaveAsImage saveAsImage = new SaveAsImage {
                Show = "true"
            };

            feature.Mark        = mark;
            feature.DataView    = dataView;
            feature.MagicType   = magicType;
            feature.Restore     = restore;
            feature.SaveAsImage = saveAsImage;
            toolbox.Feature     = feature;
            option.Toolbox      = toolbox;
        }
Ejemplo n.º 8
0
        public void Update(Boolean useTransition)
        {
            categoricalColumnViewModel = Data.First().ColumnViewModel;

            LegendAreaWidth = 0;
            D3Data          = new Data()
            {
                List = Data.Select(d => d as Object).ToList()
            };

            LegendData   = Data.Select(d => d.Key).Distinct().ToList();
            D3LegendData = new Data()
            {
                List = LegendData.Select(d => d as Object).ToList()
            };

            if (LegendVisibility == Visibility.Visible)
            {
                LegendRectangleElement.Data = D3LegendData;
                LegendRectangleElement.Update(useTransition ? TransitionType.Opacity : TransitionType.None);

                LegendTextElement.Data = D3LegendData;
                LegendTextElement.Update(useTransition ? TransitionType.Opacity : TransitionType.None);
                LegendTextElement.ForceMeasure();

                LegendAreaWidth          = LegendTextElement.MaxActualWidth + Const.LegendPatchWidth + Const.LegendPatchSpace + Const.PaddingRight;
                LegendTitleElement.Width = LegendAreaWidth;
                LegendTitleElement.Text  = LegendTitle;
                Canvas.SetTop(LegendTitleElement, LegendPatchYGetter(null, 0) - 30);
            }

            Canvas.SetLeft(LegendPanel, this.Width - LegendAreaWidth);

            if (HorizontalAxisVisibility == Visibility.Visible)
            {
                ChartAreaEndY = this.Height - Const.PaddingBottom - Const.HorizontalAxisHeight - Const.HorizontalAxisLabelHeight;
            }
            else
            {
                ChartAreaEndY = this.Height - Const.PaddingBottom;
            }

            if (LegendVisibility == Visibility.Visible)
            {
                ChartAreaEndX = this.Width - Const.PaddingRight - LegendAreaWidth;
            }
            else
            {
                ChartAreaEndX = this.Width - Const.PaddingRight - 20;
            }

            HorizontalAxisLabelCanvasLeft = Const.PaddingLeft + Const.VerticalAxisWidth + Const.VerticalAxisLabelWidth;
            HorizontalAxisLabelCanvasTop  = ChartAreaEndY + Const.HorizontalAxisHeight;
            HorizontalAxisLabelWidth      = ChartAreaEndX - Const.PaddingLeft - Const.VerticalAxisWidth - Const.VerticalAxisLabelWidth;

            VerticalAxisCanvasLeft      = Const.PaddingLeft + Const.VerticalAxisLabelWidth + Const.VerticalAxisWidth;
            VerticalAxisLabelCanvasLeft = Const.PaddingLeft + Const.VerticalAxisLabelWidth / 2 - (ChartAreaEndY - Const.PaddingTop) / 2;
            VerticalAxisLabelCanvasTop  = Const.PaddingTop + (ChartAreaEndY - Const.PaddingTop) / 2;
            VerticalAxisLabelHeight     = ChartAreaEndY - Const.PaddingTop;

            XScale = new Linear()
            {
                DomainStart = Data.Select(d => d.Value1).Min(),
                DomainEnd   = Data.Select(d => d.Value1).Max(),
                RangeStart  = VerticalAxisCanvasLeft,
                RangeEnd    = ChartAreaEndX + Const.PaddingLeft
            };

            if (XScale.DomainStart < 0)
            {
                XScale.DomainStart *= 1.1;
            }
            else
            {
                XScale.DomainStart *= 0.9;
            }

            if (XScale.DomainEnd < 0)
            {
                XScale.DomainEnd *= 0.9;
            }
            else
            {
                XScale.DomainEnd *= 1.1;
            }

            XScale.Nice();

            YScale = new Linear()
            {
                DomainStart = Data.Select(d => d.Value2).Min(),
                DomainEnd   = Data.Select(d => d.Value2).Max(),
                RangeStart  = ChartAreaEndY,
                RangeEnd    = Const.PaddingTop
            };

            if (YScale.DomainStart < 0)
            {
                YScale.DomainStart *= 1.1;
            }
            else
            {
                YScale.DomainStart *= 0.9;
            }

            if (YScale.DomainEnd < 0)
            {
                YScale.DomainEnd *= 0.9;
            }
            else
            {
                YScale.DomainEnd *= 1.1;
            }

            YScale.Nice();

            CircleElement.Data = D3Data;

            HorizontalAxis.Scale = XScale;
            Canvas.SetTop(HorizontalAxis, ChartAreaEndY);
            HorizontalAxis.Visibility = HorizontalAxisVisibility;

            Canvas.SetTop(HorizontalAxisTitleElement, HorizontalAxisLabelCanvasTop);
            Canvas.SetLeft(HorizontalAxisTitleElement, HorizontalAxisLabelCanvasLeft);
            HorizontalAxisTitleElement.Width      = HorizontalAxisLabelWidth;
            HorizontalAxisTitleElement.Visibility = HorizontalAxisVisibility;
            HorizontalAxisTitleElement.Text       = HorizontalAxisTitle;

            VerticalAxis.Scale = YScale;
            Canvas.SetLeft(VerticalAxis, VerticalAxisCanvasLeft);

            Canvas.SetTop(VerticalAxisTitleElement, VerticalAxisLabelCanvasTop);
            Canvas.SetLeft(VerticalAxisTitleElement, VerticalAxisLabelCanvasLeft);
            VerticalAxisTitleElement.Width = VerticalAxisLabelHeight;
            VerticalAxisTitleElement.Text  = VerticalAxisTitle;

            LegendHandleRectangleElement.Data       = D3LegendData;
            LegendHandleRectangleElement.Visibility = LegendVisibility;

            LegendRectangleElement.Data       = D3LegendData;
            LegendRectangleElement.Visibility = LegendVisibility;

            LegendTextElement.Data       = D3LegendData;
            LegendTextElement.Visibility = LegendVisibility;

            LegendHandleRectangleElement.Update(TransitionType.None);
            CircleElement.Update(useTransition ? TransitionType.All : TransitionType.None);
            //CircleElement.UpdateLayout();
            HorizontalAxis.Update(useTransition);
            VerticalAxis.Update(useTransition);
        }