public void Init() { areaNameLabel.Content = VoivodeshipNamesExtensions.GetName(voivodeshipName); PieChart pieChart = new PieChart(chartPosition, chartSize); pieChart.Create(mapPainter.GetAreaChartValues((int)voivodeshipName)); StatisticsData[] statisticsData = mapPainter.Holder.VoivodeshipData[(int)voivodeshipName]; StatisticsData minData = mapPainter.Holder.GetMinDatasInVoivodeship(voivodeshipName); StatisticsData maxData = mapPainter.Holder.GetMaxDatasInVoivodeship(voivodeshipName); faces = ChernoffFace.GetFaces(pieChart, statisticsData, minData, maxData); pieChart.Draw(chartCanvas); chartCanvas.Background = Brushes.Azure; foreach (ChernoffFace face in faces) { face.Draw(chartCanvas); } // ChernoffFace.AdjustView(faces, chartCanvas, chartCanvasScaleTransform, chartCanvasTranslateTransform); foreach (string sportName in mapPainter.Holder.SportNames) { sportNameCb.Items.Add(sportName); } if (sportNameCb.Items.Count > 0) { sportNameCb.SelectedIndex = 0; } }
private void drawPreview(int areaIndex) { VoivodeshipNames areaName = (VoivodeshipNames)areaIndex; prevLabel.Content = VoivodeshipNamesExtensions.GetName(areaName); Point chartPosition = new Point(previewCanvas.Width / 2, previewCanvas.Height / 2); int chartSize = (int)(previewCanvas.Width / 4); PieChart pieChart = new PieChart(chartPosition, chartSize); pieChart.Create(mapPainter.GetAreaChartValues(areaIndex)); StatisticsData[] statisticsData = mapPainter.Holder.VoivodeshipData[areaIndex]; StatisticsData minData = mapPainter.Holder.GetMinDatasInVoivodeship(areaName); StatisticsData maxData = mapPainter.Holder.GetMaxDatasInVoivodeship(areaName); ChernoffFace[] faces = ChernoffFace.GetFaces(pieChart, statisticsData, minData, maxData); previewCanvas.Children.Clear(); pieChart.Draw(previewCanvas); foreach (ChernoffFace face in faces) { face.Draw(previewCanvas); } }