예제 #1
0
        public async Task CalculateCorrelationAsync()
        {
            Status = "calculating...";
            ChartSeries.Clear();

            var data = await Task.Run(Correlate);

            var series = new double[Math.Min(MaxSamplesInOutput, Impulse.SliceCount)];

            var skip = data.Length / series.Length - 1;

            if (skip < 0)
            {
                skip = 0;
            }

            for (int i = 0; i < series.Length; i++)
            {
                series[i] = data[i * (skip + 1)];
            }

            ChartSeries.Add(new StepLineSeries
            {
                PointGeometry   = null,
                StrokeThickness = 1,

                Title  = Path.GetFileName(Impulse.FileName),
                Values = new ChartValues <double>(series)
            });

            Status = $"{Path.GetFileName(Impulse.FileName)} done";
        }
예제 #2
0
        protected override void CreateChildControls()
        {
            string[] colors = { "#FFDA43", "#2F89C2", "#F267CD", "#79E364", "#EB5D2D", "#42AE18", "#FF9C40", "#B99A72", "#9BC0FF", "#98CC88", "#C3B600" };
            chart                  = new RadChart();
            chart.UseSession       = false;
            chart.TempImagesFolder = "~/_layouts/temp";
            chart.RadControlsDir   = "~/_layouts/radcontrols/RadControls/";

            ChartSeries chartSeries = new ChartSeries();

            chart.AddChartSeries(chartSeries);
            ChartTitle title = new ChartTitle();


            ChartSeries series = chart.GetChartSeries(0);

            series.Name = surveyQuestion;

            chart.Legend.HAlignment  = ChartHAlignment.Center;
            chart.Legend.VAlignment  = ChartVAlignment.Bottom;
            chart.Legend.LegendStyle = LegendItemsPositionType.Row;


            response               = GetSurveyResponse("http://server/sites/techresources/", "http://server/sites/techresources/Lists/Survey2");
            title.Text             = surveyQuestion;
            title.TextFont         = new Font("Verdana", 7);
            chart.Chart.ChartTitle = title;

            series.Clear();
            series.DiameterScale            = 0.40;
            series.ShowLabelConnectors      = false;
            series.ShowLabels               = true;
            series.LabelAppearance.Distance = 7;
            series.LabelAppearance.TextFont = new Font("Verdana", 7);
            series.NotOverlapLabels         = true;
            series.Type = ChartSeriesType.Pie;
            ColorConverter cc = new ColorConverter();
            int            i  = 0;

            foreach (Response res in response)
            {
                ChartSeriesItem seriesItem = new ChartSeriesItem();
                seriesItem.YValue                 = res.totalResponse;
                seriesItem.ItemMap.ToolTip        = res.choiceName;
                seriesItem.Label                  = res.totalResponse.ToString();
                seriesItem.Appearance.MainColor   = (Color)cc.ConvertFromString(colors[i++]);
                seriesItem.Appearance.BorderColor = Color.DimGray;
                seriesItem.Appearance.FillStyle   = FillStyle.Solid;
                seriesItem.Name = res.choiceName;
                series.Items.Add(seriesItem);
            }
            chart.Skin = "LightGreen";
            this.Controls.Add(chart);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dt = from k in _entities.GetBienDongNhanSu() orderby k.namsinh select k;
            List <GetBienDongNhanSu_Result> newLstBienDong = new List <GetBienDongNhanSu_Result>();
            List <GetBienDongNhanSu_Result> lstBienDong    = dt.ToList();
            int?SumNV = lstBienDong[0].soNV;

            for (int i = 1; i < lstBienDong.Count; i++)
            {
                SumNV += lstBienDong[i].soNV;
                lstBienDong[i].soNV = SumNV;
                newLstBienDong.Add(lstBienDong[i]);
            }
            RadChart1.Series[0].DataYColumn           = "soNV";
            RadChart1.PlotArea.XAxis.DataLabelsColumn = "namsinh";
            RadChart1.DataSource = newLstBienDong;
            RadChart1.DataBind();

            RadChart2.IntelligentLabelsEnabled = false;
            List <GetTyLeNamNu_Result> lstTyLe = _entities.GetTyLeNamNu().ToList();
            ChartSeries serie = new ChartSeries();

            serie.Name = "Giới tính";
            serie.Type = ChartSeriesType.Pie;
            serie.Clear();
            serie.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            ChartSeriesItem item1 = new ChartSeriesItem();

            item1.YValue = (double)lstTyLe[0].Nam;
            //item1.Name = "Nam";
            item1.Appearance.Exploded  = true;
            item1.Label.TextBlock.Text = "Nam" + " - #%";
            serie.Items.Add(item1);

            ChartSeriesItem item2 = new ChartSeriesItem();

            item2.YValue = (double)lstTyLe[0].Nu;
            //item2.Name = "Nữ";
            item2.Appearance.Exploded  = true;
            item2.Label.TextBlock.Text = "Nữ" + " - #%";

            serie.Items.Add(item2);
            RadChart2.Series.Add(serie);
        }