Exemplo n.º 1
0
        public FileResult ChartSample()
        {
            var chart = new System.Web.UI.DataVisualization.Charting.Chart();

            chart.BackColor = System.Drawing.Color.Transparent;
            chart.BackColor = System.Drawing.Color.FromArgb(0, 0, 0);

            chart.Width  = System.Web.UI.WebControls.Unit.Pixel(250);
            chart.Height = System.Web.UI.WebControls.Unit.Pixel(2500);

            var series = new System.Web.UI.DataVisualization.Charting.Series();

            series.ChartArea = "ca1";



            series.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;
            //series.Font = new Font("Verdana", 8.25f, FontStyle.Regular);

            System.Random myRandom = new System.Random();

            for (int i = 0; i < 100; i++)
            {
                var dp = new System.Web.UI.DataVisualization.Charting.DataPoint();
                dp.AxisLabel = String.Format("{0}-{1}", i, Guid.NewGuid().ToString().Substring(0, 4));
                dp.YValues   = new double[] { myRandom.Next(5, 100) };
                series.Points.Add(dp);
            } // Next i


            chart.Series.Add(series);

            var area = new System.Web.UI.DataVisualization.Charting.ChartArea("ca1");

            area.Area3DStyle.Enable3D = false;
            area.AxisX.Interval       = 1;
            //area.BackColor = Color.Transparent;
            //var labelStyle = new LabelStyle();
            //labelStyle.Enabled = true;
            //labelStyle.Font = new Font("Arial", 3f);
            area.AxisX.LabelStyle.Font = new System.Drawing.Font("Verdana", 8.25f, System.Drawing.FontStyle.Underline);//Why does it recognize the style but not the font!!!???

            area.BackColor = System.Drawing.Color.Red;
            //area.BackColor = System.Drawing.Color.White;

            chart.ChartAreas.Add(area);

            /*
             * using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
             * {
             *  chart.SaveImage(ms, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
             *  ms.Seek(0, System.IO.SeekOrigin.Begin);
             *
             *  return File(ms.ToArray(), "image/png", "mychart.png");
             * } // End Using ms
             */
            return(Chart2Image(chart));
        } // End Action ChartSample
Exemplo n.º 2
0
    public void AfterLoad1()
    {
        // Number of data points

        int      numOfPoints = 20;
        string   shift       = ddl_shiftchart.Value.ToString();
        string   indicator   = ddl_indicator.Text.ToString();
        string   unit        = ddl_unit_eff.Text.ToString();
        string   machn       = Slct_machine_eff.Value.ToString();
        DateTime fromdate    = Convert.ToDateTime(txt_fromdate_chart.Value.ToString());
        DateTime todate      = Convert.ToDateTime(txt_todate_chart.Value.ToString());

        // Generate rundom data

        GenerateChart1(indicator, shift, unit, machn, fromdate, todate, Chart2.Series["Default1"], numOfPoints);

        // Make Pareto Chart

        MakeParetoChart1(Chart2, "Default1", "Paretochart");

        // Set chart types for output data

        Chart2.Series["Paretochart"].ChartType = SeriesChartType.Line;



        // set the markers for each point of the Pareto Line

        Chart2.Series["Paretochart"].IsValueShownAsLabel = true;

        Chart2.Series["Paretochart"].MarkerColor = System.Drawing.Color.Red;

        Chart2.Series["Paretochart"].MarkerBorderColor = System.Drawing.Color.Black;

        Chart2.Series["Paretochart"].MarkerStyle = MarkerStyle.Circle;

        Chart2.Series["Paretochart"].MarkerSize = 10;

        Chart2.Series["Paretochart"].LabelFormat = "0.#";  // format with one decimal and leading zero

        // Set Color of line Pareto chart

        Chart2.Series["Paretochart"].Color = System.Drawing.Color.FromArgb(252, 180, 65);
        System.Web.UI.DataVisualization.Charting.Series series = new System.Web.UI.DataVisualization.Charting.Series();

        //for (int i = 0; i < dowtime.Length; i++)
        //{
        //   series.Points.AddXY(dowtime[i].ToString(), 0);
        //}
        //Chart1.ChartAreas["ChartArea1"].AxisY.Maximum = 100;
        //Chart1.ChartAreas["ChartArea1"].AxisY.Minimum = 10;
        //Chart1.ChartAreas["ChartArea1"].AxisY.Interval = 10;
    }
Exemplo n.º 3
0
        protected void AddNewSeriesHorizLine(MSCHART.Chart chart, WebCharting.Data.SeriesDataPoints datapoints, WebCharting.Data.AxisLabels labels)
        {
            var ser = new MSCHART.Series();

            ser.Points.DataBindXY(labels.ToArray(), datapoints.GetDoubleArray());
            if (datapoints.Name != null)
            {
                ser.LegendText = datapoints.Name;
            }
            for (int i = 0; i < datapoints.Count; i++)
            {
                var chart_datapoint = ser.Points[i];
                var v = datapoints[i];
            }
            chart.Series.Add(ser);
        }
        protected void Chart3_PrePaint(object sender, System.Web.UI.DataVisualization.Charting.ChartPaintEventArgs e)
        {
            if (e.ChartElement is System.Web.UI.DataVisualization.Charting.Series && ((System.Web.UI.DataVisualization.Charting.Series)e.ChartElement).Name == "Series1")
            {
                System.Web.UI.DataVisualization.Charting.Series        s  = e.Chart.Series[0];
                System.Web.UI.DataVisualization.Charting.ChartGraphics cg = e.ChartGraphics;

                // Highlight the maximum sales this year
                for (int i = 0; i < s.Points.Count; i++)
                {
                    string colour = StudentLogic.getCustomColour(float.Parse(s.Points[i].YValues[0].ToString()));

                    s.Points[i].Color = System.Drawing.ColorTranslator.FromHtml(colour);
                }
            }
        }
Exemplo n.º 5
0
        private void ApplySeries(DV.Chart chart)
        {
            foreach (var seriesData in _series)
            {
                var series = new DV.Series();
                try {
                    series.AxisLabel  = seriesData.AxisLabel ?? String.Empty;
                    series.ChartArea  = seriesData.ChartArea ?? String.Empty;
                    series.ChartType  = seriesData.ChartType;
                    series.Legend     = seriesData.Legend ?? String.Empty;
                    series.MarkerStep = seriesData.MarkerStep;
                    series.Name       = seriesData.Name ?? String.Empty;

                    // data-bind the series (todo - support o.Points.DataBind())
                    if (seriesData.DataSource != null)
                    {
                        if (String.IsNullOrEmpty(seriesData.DataSource.YFields))
                        {
                            var yValues      = seriesData.DataSource.DataSource;
                            var yValuesArray = yValues as IEnumerable[];
                            if ((yValuesArray != null) && !(yValues is string[]))
                            {
                                series.Points.DataBindXY(seriesData.DataSource.XDataSource, yValuesArray);
                            }
                            else
                            {
                                series.Points.DataBindXY(seriesData.DataSource.XDataSource, yValues);
                            }
                        }
                        else
                        {
                            series.Points.DataBindXY(seriesData.DataSource.XDataSource, seriesData.DataSource.XField,
                                                     seriesData.DataSource.DataSource, seriesData.DataSource.YFields);
                        }
                    }
                }
                catch (Exception) { // see notes above
                    series.Dispose();
                    throw;
                }
                chart.Series.Add(series);
            }
        }
        protected void Chart1_PrePaint(object sender, System.Web.UI.DataVisualization.Charting.ChartPaintEventArgs e)
        {
            if (e.ChartElement is System.Web.UI.DataVisualization.Charting.Series && ((System.Web.UI.DataVisualization.Charting.Series)e.ChartElement).Name == "Series1")
            {
                System.Web.UI.DataVisualization.Charting.Series        s  = e.Chart.Series[0];
                System.Web.UI.DataVisualization.Charting.ChartGraphics cg = e.ChartGraphics;
                double max = s.Points.FindMaxByValue().YValues[0];

                // Highlight the maximum sales this year
                for (int i = 0; i < s.Points.Count; i++)
                {
                    string colour = StudentLogic.getColourForResult(float.Parse(s.Points[i].YValues[0].ToString()));
                    s.Points[i].Color = System.Drawing.ColorTranslator.FromHtml(colour);
                    if (s.Points[i].XValue.Equals(Session["courseID"].ToString()))
                    {
                    }
                }
            }
        }
Exemplo n.º 7
0
        protected void AddNewSeries(MSCHART.Chart chart, WebCharting.Data.SeriesDataPoints datapoints, WebCharting.Data.AxisLabels labels)
        {
            var ser = new MSCHART.Series();

            ser.Points.DataBindXY(labels.ToArray(), datapoints.GetDoubleArray());
            if (datapoints.Name != null)
            {
                ser.LegendText = datapoints.Name;
            }
            for (int i = 0; i < datapoints.Count; i++)
            {
                var chart_datapoint = ser.Points[i];
                var v = datapoints[i];

                if (v.ToolTip != null && v.ToolTip.Text != null)
                {
                    chart_datapoint.ToolTip = v.ToolTip.Text;
                }

                if (v.Hyperlink != null)
                {
                    chart_datapoint.Url = v.Hyperlink;
                }
            }


            if (datapoints.Hyperlink != null)
            {
                ser.Url = datapoints.Hyperlink;
            }

            if (datapoints.ToolTip != null && datapoints.ToolTip.Text != null)
            {
                ser.ToolTip = datapoints.ToolTip.Text;
            }
            chart.Series.Add(ser);
        }
Exemplo n.º 8
0
        protected async void btnViewResult_Click(object sender, EventArgs e)
        {
            divResult.InnerHtml = "";
            Random rnd = new Random();

            divResult.Visible = true;
            var web3 = new Nethereum.Web3.Web3(new Account("0xc9f253cd0c04db9ed50ff10aa7f44c03f4b5cf4ef1797a09ec152870245c8454"), strURL);
            //var web3 = new Nethereum.Web3.Web3(strURL);
            // Contract voteContract = web3.Eth.GetContract(ABI, address);
            var contract = web3.Eth.GetContract(ABI, ddlVotesAvailable.SelectedItem.Value);
            var fucntion = contract.GetFunction("getVotes");
            var result   = await fucntion.CallAsync <List <UInt16> >();

            List <Data> mylist = new List <Data>();

            for (int i = 0; i <= rblVoteOptions.Items.Count - 1; i++)
            {
                mylist.Add(new Data(result[i], rblVoteOptions.Items[i].Text));
                divResult.InnerHtml += $"{rblVoteOptions.Items[i].Text} - {result[i]}<br>";
            }


            Chart1.DataSource = mylist;
            Chart1.BackColor  = Color.Transparent;
            Chart1.Width      = Unit.Pixel(450);
            Chart1.Height     = Unit.Pixel(400);
            System.Web.UI.DataVisualization.Charting.Series sr1 = Chart1.Series[0];
            sr1.XValueMember  = "StringData";
            sr1.YValueMembers = "IntegerData";
            sr1.Font          = new Font("Verdana", 8.25f, FontStyle.Regular);
            //  ChartArea ca1 = new ChartArea("ChartArea1");
            Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
            Chart1.ChartAreas["ChartArea1"].BackColor = Color.Transparent;
            // Chart1.ChartAreas.Add(ca1);
        }
Exemplo n.º 9
0
        protected override void format_series(MSCHART.Series series, int series_index)
        {
            var series_pal_item = this.Palette[series_index];

            if (this.GradientStyle == GradientStyle.FlatColor)
            {
                series.Color = series_pal_item.Color.ToSystemColor();
            }
            else
            {
                if (this.BarStyle == BarStyle.Horizontal)
                {
                    series.Color              = series_pal_item.Color.ToSystemColor();
                    series.BackGradientStyle  = MSCHART.GradientStyle.LeftRight;
                    series.BackSecondaryColor = series_pal_item.SecondaryColor.ToSystemColor();
                }
                else
                {
                    series.Color              = series_pal_item.Color.ToSystemColor();
                    series.BackGradientStyle  = MSCHART.GradientStyle.TopBottom;
                    series.BackSecondaryColor = series_pal_item.SecondaryColor.ToSystemColor();
                }
            }
        }
Exemplo n.º 10
0
 protected abstract void format_series(MSCHART.Series series, int series_index);
Exemplo n.º 11
0
        /// <summary>
        /// Metodo que se encarga de crear el 'Coco' de los gráficos de barra
        /// </summary>
        /// <returns></returns>
        public System.Web.UI.DataVisualization.Charting.Chart CrearTorta()
        {
            System.Web.UI.DataVisualization.Charting.Chart TortaRecursos = new System.Web.UI.DataVisualization.Charting.Chart();
            TortaRecursos.Width             = System.Web.UI.WebControls.Unit.Pixel(650);
            TortaRecursos.Height            = System.Web.UI.WebControls.Unit.Pixel(400);
            TortaRecursos.BackGradientStyle = GradientStyle.TopBottom;

            Legend Default = new Legend();

            Default.LegendStyle   = LegendStyle.Row;
            Default.Docking       = Docking.Bottom;
            Default.Alignment     = StringAlignment.Center;
            Default.BackColor     = Color.Transparent;
            Default.IsTextAutoFit = false;
            //Font font = new Font();
            //font.FontFamily=FontFamily.
            //Default.Font=
            TortaRecursos.Legends.Add(Default);



            ChartArea ChartArea1 = new ChartArea("ChartArea1");

            System.Web.UI.DataVisualization.Charting.Axis axisX = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;
            axisX.IsLabelAutoFit    = true;
            axisX.Interval          = 1;


            System.Web.UI.DataVisualization.Charting.Axis axisY = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.Interval = 0.2;

            ChartArea1.AxisX = axisX;
            ChartArea1.AxisY = axisY;

            //Color borderColor = new Color();
            //borderColor.A = 64;
            //borderColor.B = 64;
            //borderColor.G = 64;
            //borderColor.R = 64;
            //ChartArea1.BorderColor=borderColor;
            ChartArea1.BackColor            = Color.Transparent;
            ChartArea1.BackSecondaryColor   = Color.Transparent;
            ChartArea1.Area3DStyle.Enable3D = true;
            ChartArea1.BorderWidth          = 0;

            TortaRecursos.ChartAreas.Add(ChartArea1);

            System.Web.UI.DataVisualization.Charting.Series tipoRecurso = new System.Web.UI.DataVisualization.Charting.Series("Recursos");
            tipoRecurso.ShadowColor                 = Color.Gray;
            tipoRecurso.ChartType                   = SeriesChartType.Pie;
            tipoRecurso.IsVisibleInLegend           = true;
            tipoRecurso.MarkerImageTransparentColor = Color.Aqua;
            tipoRecurso.Label = "#PERCENT{P1}";
            tipoRecurso.IsValueShownAsLabel = true;
            tipoRecurso.LabelForeColor      = Color.White;
            tipoRecurso.XValueType          = ChartValueType.Auto;
            TortaRecursos.Series.Add(tipoRecurso);


            return(TortaRecursos);
        }
Exemplo n.º 12
0
        public string CrearGraficoBarra(Empresa empresa, string strDirectorio)
        {
            System.Web.UI.DataVisualization.Charting.Chart Chart1 = new System.Web.UI.DataVisualization.Charting.Chart();
            Chart1.Width  = System.Web.UI.WebControls.Unit.Pixel(650);
            Chart1.Height = System.Web.UI.WebControls.Unit.Pixel(400);

            Legend legend = new Legend();

            legend.LegendStyle = LegendStyle.Table;
            legend.Docking     = Docking.Bottom;
            Chart1.Legends.Add(legend);

            ChartArea ChartArea1 = new ChartArea("ChartArea1");

            System.Web.UI.DataVisualization.Charting.Axis axisX = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.LabelAutoFitStyle       = LabelAutoFitStyles.LabelsAngleStep90;
            axisX.LabelAutoFitMaxFontSize = 10;
            axisX.IsLabelAutoFit          = true;
            axisX.Interval = 1;

            System.Web.UI.DataVisualization.Charting.Axis axisY = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.Interval = 0.2;

            ChartArea1.AxisX = axisX;
            ChartArea1.AxisY = axisY;


            Chart1.ChartAreas.Add(ChartArea1);

            System.Web.UI.DataVisualization.Charting.Series Recursos = new System.Web.UI.DataVisualization.Charting.Series("Recursos");
            Recursos.ShadowColor       = Color.Gray;
            Recursos.ChartType         = SeriesChartType.Column;
            Recursos.IsVisibleInLegend = true;
            Chart1.Series.Add(Recursos);

            System.Web.UI.DataVisualization.Charting.Series srPromedio = new System.Web.UI.DataVisualization.Charting.Series("Promedio");
            srPromedio.ShadowColor = Color.Red;
            srPromedio.ChartType   = SeriesChartType.Line;
            srPromedio.BorderWidth = 2;
            Chart1.Series.Add(srPromedio);

            List <Entidades.MatrizValoracion> MatrizValoracion = new List <RBV_Clases.MatrizValoracion>();
            List <RBV_Clases.RecursoValioso>  recursosValiosos = new List <RBV_Clases.RecursoValioso>();
            decimal ValorTotal = 0;

            MatrizValoracion = RBV_Negocio.MatrizBO.ConsultarMatrizValoracion(empresa.IdEmpresa).OrderBy(p => p.IdCaracteristica).ThenBy(p => p.IdRecurso).ToList();

            if (MatrizValoracion.Count > 0)
            {
                recursosValiosos = RBV_Negocio.MatrizBO.CalcularResultadosMatriz(MatrizValoracion, empresa.IdEmpresa);
                ValorTotal       = recursosValiosos.Sum(p => p.Valor) / recursosValiosos.Count;
            }
            string[]  Titulos  = recursosValiosos.Select(p => p.NombreRecurso).ToArray();
            decimal[] Valores  = recursosValiosos.Select(p => p.Valor).ToArray();
            decimal[] Promedio = new decimal[Titulos.Length];

            Chart1.Series["Recursos"].Points.DataBindXY(Titulos, Valores);
            for (int i = 0; i < Titulos.Length; i++)
            {
                Promedio[i] = ValorTotal;
            }

            Chart1.Series["Promedio"].Points.DataBindXY(Titulos, Promedio);
            string strFile = "Barra" + empresa.NombreEmpresa + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".Jpeg";
            string imgName = string.Concat(strDirectorio, "\\", strFile);

            Chart1.SaveImage(imgName, ChartImageFormat.Jpeg);
            return(imgName);
        }
Exemplo n.º 13
0
        protected void AddNewSeries(MSCHART.Chart chart, WebCharting.Data.SeriesDataPoints datapoints, WebCharting.Data.AxisLabels labels)
        {
            var ser = new MSCHART.Series();
            ser.Points.DataBindXY(labels.ToArray(), datapoints.GetDoubleArray());
            if (datapoints.Name != null)
            {
                ser.LegendText = datapoints.Name;
            }
            for (int i = 0; i < datapoints.Count; i++)
            {
                var chart_datapoint = ser.Points[i];
                var v = datapoints[i];

                if (v.ToolTip != null && v.ToolTip.Text != null)
                {
                    chart_datapoint.ToolTip = v.ToolTip.Text;
                }

                if (v.Hyperlink != null)
                {
                    chart_datapoint.Url = v.Hyperlink;
                }
            }


            if (datapoints.Hyperlink != null)
            {
                ser.Url = datapoints.Hyperlink;
            }

            if (datapoints.ToolTip != null && datapoints.ToolTip.Text != null)
            {
                ser.ToolTip = datapoints.ToolTip.Text;
            }
            chart.Series.Add(ser);
        }
Exemplo n.º 14
0
        // http://stackoverflow.com/questions/6047961/c-sharp-chart-rotate-labels
        public FileResult RadarSample()
        {
            int pixelWidth  = 1000;
            int pixelHeight = 1000;

            // Populate series data
            //string[] xValues = { "France", "Canada", "Germany", "USA", "Italy", "Spain", "Russia", "Sweden", "Japan" };

            string[] xValues = { "Offene\nAussenpolitik", "Liberale\nWirtschaftspolitik", "Restriktive\nFinanzpolitik", "Law & Order", "Restriktive\nMigrationspolitik", "Ausgebauter\nUmweltschutz", "Ausgebauter\nSozialstaat", "Liberale\nGesellschaft" };
            double[] yValues = { 80, 90, 45, 75, 37.5, 40, 28, 54 };


            //double[] yValues = { 65.62, 75.54, 60.45, 34.73, 85.42, 55.9, 63.6, 55.1, 77.2 };
            //double[] yValues2 = { 76.45, 23.78, 86.45, 30.76, 23.79, 35.67, 89.56, 67.45, 38.98 };


            var Chart1 = new System.Web.UI.DataVisualization.Charting.Chart();


            var area = new System.Web.UI.DataVisualization.Charting.ChartArea("ca1");

            area.Area3DStyle.Enable3D = false;
            //area.AxisX.Interval = 1;


            Chart1.BackColor = System.Drawing.Color.HotPink;
            Chart1.BackColor = System.Drawing.Color.White;

            area.BackColor = System.Drawing.Color.Red;
            area.BackColor = System.Drawing.Color.Transparent;

            //area.AxisY.Interval = 5;

            area.AxisY.MajorTickMark.Enabled = false;
            area.AxisY.MajorGrid.LineColor   = Color.Gray;
            area.AxisY.MajorGrid.Interval    = 25;

            area.AxisY.MinorTickMark.Enabled = false;
            area.AxisY.MinorGrid.Interval    = 5;
            area.AxisY.MinorGrid.LineColor   = Color.Yellow;

            Chart1.ChartAreas.Add(area);


            var series1 = new System.Web.UI.DataVisualization.Charting.Series();
            var series2 = new System.Web.UI.DataVisualization.Charting.Series();

            series1.Name = "Series1";
            series2.Name = "Series2";

            //series1.Color = System.Drawing.Color.Yellow;
            series1.Color = System.Drawing.Color.FromArgb(100, 84, 130, 255);
            series1.SmartLabelStyle.Enabled = true;
            //series1.LabelAngle = 90;

            //Legend legend = new Legend();

            ////legend.Name = "mylegend";
            //legend.Title = "Hello world";
            //legend.BackColor = Color.Transparent;
            //legend.BackColor = Color.Tomato;

            //Chart1.Legends.Add(legend);


            // series1.Legend = "mylegend";
            series1.LegendText = "A";
            series2.LegendText = "B";

            // series1.Label = "kickme";
            // series2.Label = "bar";

            //series1.ChartArea = "ca1";

            series1.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Radar;
            series2.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Radar;

            series1.ChartArea = "ca1";
            series2.ChartArea = "ca1";


            Chart1.Series.Add(series1);
            //Chart1.Series.Add(series2);


            Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues);
            //Chart1.Series["Series2"].Points.DataBindXY(xValues, yValues2);

            Chart1.Series["Series1"].SmartLabelStyle.Enabled = false;
            // Chart1.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep30;
            // Chart1.ChartAreas[0].AxisX.LabelStyle.Angle = 30;

            Chart1.ChartAreas[0].Axes[0].CustomLabels.Add((double)0, (double)0, "hello");
            Chart1.ChartAreas[0].Axes[0].CustomLabels.Add((double)1, (double)0, "bar");



            for (int i = 0; i < Chart1.ChartAreas[0].Axes[0].CustomLabels.Count; ++i)
            {
                Chart1.ChartAreas[0].Axes[0].CustomLabels[0].Axis.TextOrientation = TextOrientation.Rotated90;
            }

            for (int i = 0; i < Chart1.Series["Series1"].Points.Count; ++i)
            {
                Chart1.Series["Series1"].Points[i].LabelAngle     = -30;
                Chart1.Series["Series1"].Points[i].LabelBackColor = System.Drawing.Color.Turquoise;
                //Chart1.Series["Series1"].Points[i].AxisLabel = "This works";
                Chart1.Series["Series1"].IsValueShownAsLabel = true;
            }


            /*
             *  foreach (DataPoint dp2 in Chart1.Series["Series1"].Points)
             *  {
             *      Console.WriteLine(dp2);
             *      //series1.SmartLabelStyle.Enabled = true;
             *
             *      dp2.LabelAngle = 30;
             *  }
             *
             * DataPoint dp = new DataPoint(0, 0);
             * dp.AxisLabel = "hollavballoo";
             * dp.LabelAngle = 30;
             */

            //series1.Points.Add(dp);



            string[] astrRadarStyleList       = new string[] { "Area", "Line", "Marker" }; // Fill, Line, or point
            string[] astrAreaDrawingStyleList = new string[] { "Circle", "Polygon" };      // Shape
            string[] astrLabelStyleList       = new string[] { "Circular", "Radial", "Horizontal" };



            string strRadarStyle       = astrRadarStyleList[0];
            string strAreaDrawingStyle = astrAreaDrawingStyleList[0];
            string strLabelStyle       = astrLabelStyleList[0];


            Chart1.Width  = System.Web.UI.WebControls.Unit.Pixel(pixelWidth);
            Chart1.Height = System.Web.UI.WebControls.Unit.Pixel(pixelHeight);


            // Set radar chart style
            Chart1.Series["Series1"]["RadarDrawingStyle"] = strRadarStyle; // RadarStyleList.SelectedItem.Text;
            //Chart1.Series["Series2"]["RadarDrawingStyle"] = strRadarStyle; // RadarStyleList.SelectedItem.Text;



            if (strRadarStyle == "Area")
            {
                Chart1.Series["Series1"].BorderColor = Color.FromArgb(100, 100, 100);
                Chart1.Series["Series1"].BorderWidth = 1;
                // Chart1.Series["Series2"].BorderColor = Color.FromArgb(100, 100, 100);
                // Chart1.Series["Series2"].BorderWidth = 1;
            }
            else if (strRadarStyle == "Line")
            {
                Chart1.Series["Series1"].BorderColor = Color.Empty;
                Chart1.Series["Series1"].BorderWidth = 2;
                // Chart1.Series["Series2"].BorderColor = Color.Empty;
                // Chart1.Series["Series2"].BorderWidth = 2;
            }
            else if (strRadarStyle == "Marker")
            {
                Chart1.Series["Series1"].BorderColor = Color.Empty;
                // Chart1.Series["Series2"].BorderColor = Color.Empty;
            }

            // Set circular area drawing style
            Chart1.Series["Series1"]["AreaDrawingStyle"] = strAreaDrawingStyle; // AreaDrawingStyleList.SelectedItem.Text;
            //Chart1.Series["Series2"]["AreaDrawingStyle"] = strAreaDrawingStyle; // AreaDrawingStyleList.SelectedItem.Text;



            // Set labels style
            //Chart1.Series["Series1"]["CircularLabelsStyle"] = strLabelStyle; // LabelStyleList.SelectedItem.Text;
            //Chart1.Series["Series2"]["CircularLabelsStyle"] = strLabelStyle; //LabelStyleList.SelectedItem.Text;

            return(Chart2Image(Chart1));
        }
Exemplo n.º 15
0
 protected override void format_series(MSCHART.Series series, int series_index)
 {
     // do nothing
 }
Exemplo n.º 16
0
        /// <summary>
        /// A cleanup method that ensures the XValues are sorted accordingly and set explicitly.
        /// It will also create the totals for the DUMMY series.
        /// </summary>
        private void AdjustXValues(System.Web.UI.DataVisualization.Charting.Series series)
        {
            bool AddDummyPoints = true;

            if (series.Name == "DUMMY")
            {
                return;
            }
            else if (ChartObj.Series["DUMMY"].Points.Count > 0)
            {
                AddDummyPoints = false;
            }

            // sort the series
            series.Sort(PointSortOrder.Ascending, "X");

            bool IsIndexed = false;

            if (series.IsXValueIndexed)
            {
                IsIndexed = true;
            }
            else
            {
                bool IsFirstPoint    = true;
                bool IsLastPointZero = false;

                // the series X values must be set and greater than zero
                foreach (DataPoint pt in series.Points)
                {
                    if (pt.XValue == 0 && !IsFirstPoint && IsLastPointZero)
                    {
                        IsIndexed = true;
                        break;
                    }
                    else if (pt.XValue == 0 && IsFirstPoint)
                    {
                        IsLastPointZero = true;
                    }

                    IsFirstPoint = false;
                }
            }

            if (IsIndexed)
            {
                series.IsXValueIndexed = false;
                int XValue = 0;

                foreach (DataPoint pt in series.Points)
                {
                    pt.XValue = ++XValue;
                }
            }

            series.Points.AddXY(series.Points[series.Points.Count - 1].XValue + 1, 0);
            series.Points[series.Points.Count - 1].AxisLabel   = "Total";
            series.Points[series.Points.Count - 1].Color       = Color.Transparent;
            series.Points[series.Points.Count - 1].BorderColor = Color.Transparent;

            int index = 0;

            foreach (DataPoint pt in series.Points)
            {
                if (AddDummyPoints)
                {
                    ChartObj.Series["DUMMY"].Points.AddXY(pt.XValue, pt.YValues[0]);
                }
                else
                {
                    ChartObj.Series["DUMMY"].Points[index].YValues[0] += pt.YValues[0];
                }

                index++;
            }
        }