Exemplo n.º 1
0
        public void bindEngagmentPieChart(string campId, int pageIndex)
        {
            Campaign objCampaign = new Campaign(ConnectionString);
            DataTable EngagLinkUrls = objCampaign.getTop10MailingLinkUrlsByCampaign(ConnectionString, campId);
            ArrayList yValues = new ArrayList(EngagLinkUrls.AsEnumerable().Select(row => row.Field<int>("Clicks")).ToArray());
            ArrayList percentageValues = new ArrayList(EngagLinkUrls.AsEnumerable().Select(row => row.Field<string>("percentage")).ToArray());
            ArrayList LinkNames = new ArrayList(EngagLinkUrls.AsEnumerable().Select(row => row.Field<string>("LinkURL")).ToArray());

            //int[] yValues = EngagLinkUrls.AsEnumerable().Select(row => row.Field<int>("Clicks")).ToArray();
            //string[] percentageValues = EngagLinkUrls.AsEnumerable().Select(row => row.Field<string>("percentage")).ToArray();
            //string[] LinkNames = EngagLinkUrls.AsEnumerable().Select(row => row.Field<string>("LinkURL")).ToArray();
            double plotY = 0;
            ShowCampaignCountChart.Series["Series1"].Points.Clear();
            if (yValues.Count != 0)
            {
                //yValues.Add(Convert.ToDouble(opencount));
                for (int pointIndex = 0; pointIndex < yValues.Count; pointIndex++)
                {
                    plotY = Convert.ToDouble(yValues[pointIndex]);
                    ShowCampaignCountChart.Series["Series1"].Points.AddY(plotY);
                    ShowCampaignCountChart.Series["Series1"].Points[pointIndex].LabelForeColor = System.Drawing.Color.FromArgb(7, 116, 167);//System.Drawing.Color.RoyalBlue;
                    //ShowCampaignCountChart.Series["Series1"].Points[pointIndex].ToolTip = "Clicks:" + yValues[pointIndex].ToString() + " (" + percentageValues[pointIndex].ToString() + "%" + ")";
                    ShowCampaignCountChart.Series["Series1"].Points[pointIndex].Label = yValues[pointIndex].ToString() + " (" + percentageValues[pointIndex].ToString() + "%" + ")";

                    ShowCampaignCountChart.Series["Series1"].Points[pointIndex].ToolTip = LinkNames[pointIndex].ToString();

                    // Set the pie labels to be drawn outside of the pie chart
                    ShowCampaignCountChart.Series[0]["PieLabelStyle"] = "Outside";//CustomProperties="PieLabelStyle=Outside, PieDrawingStyle=Concave"
                    ShowCampaignCountChart.Series[0]["PieDrawingStyle"] = "Concave";

                    // Set these other two properties so that you can see the connecting lines
                    //ShowCampaignCountChart.Series[0].BorderWidth = 1;
                    //ShowCampaignCountChart.Series[0].BorderColor = System.Drawing.Color.FromArgb(7, 116, 167);
                    ShowCampaignCountChart.Series["Series1"].Points[pointIndex].Label = yValues[pointIndex].ToString() + " (" + percentageValues[pointIndex].ToString() + "%" + ")";
                }
            }
            //show Chart
            ShowCampaignCountChart.Series["Series1"].ChartType = SeriesChartType.Pie;
            ShowCampaignCountChart.Series["Series1"]["PieStartAngle"] = "30";
            yValues.Clear();
            percentageValues.Clear();
            LinkNames.Clear();
        }