private void drawChart()
        {
            //GET THE TOP 4 BROWSERS BY VIEW
            SortableCollection <KeyValuePair <string, int> > topBrowsers = PageViewDataSource.GetViewsByBrowser(4, 0, "ViewCount DESC, Browser ASC");

            if (topBrowsers.Count > 0)
            {
                //FIND OUT HOW MANY VIEWS TOTAL
                int totalPageViews   = PageViewDataSource.CountAll();
                int pageViewsCharted = 0;
                //List<double> viewCounts = new double[topBrowsers.Count];
                //string[] browserNames = new string[topBrowsers.Count];
                List <int>    viewCounts   = new List <int>();
                List <string> browserNames = new List <string>();
                foreach (KeyValuePair <string, int> browserView in topBrowsers)
                {
                    browserNames.Add(browserView.Key);
                    viewCounts.Add(browserView.Value);
                    pageViewsCharted += browserView.Value;
                }
                if (pageViewsCharted < totalPageViews)
                {
                    //NEED TO ADD AN "OTHER" PIE SLICE
                    browserNames.Add("Other");
                    viewCounts.Add(totalPageViews - pageViewsCharted);
                }
                //BUILD BAR CHART
                BrowserChart.Series["Browsers"].Points.Clear();
                for (int i = 0; i < topBrowsers.Count; i++)
                {
                    DataPoint point = new DataPoint(BrowserChart.Series["Browsers"]);
                    point.SetValueXY(browserNames[i], new object[] { viewCounts[i] });
                    BrowserChart.Series["Browsers"].Points.Add(point);
                }
                BrowserChart.DataBind();
            }
            else
            {
                //NO CATEGORIES HAVE BEEN VIEWED YET OR PAGE TRACKING IS NOT AVAIALBEL
                this.Controls.Clear();
                Panel noViewsPanel = new Panel();
                noViewsPanel.CssClass = "emptyData";
                Label noViewsMessage = new Label();
                noViewsMessage.Text = "No categories have been viewed or page tracking is disabled.";
                noViewsPanel.Controls.Add(noViewsMessage);
                this.Controls.Add(noViewsPanel);
            }
        }
Esempio n. 2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     _Settings = AbleContext.Current.Store.Settings;
     if (!Page.IsPostBack)
     {
         TrackPageViews.Checked          = _Settings.PageViewTrackingEnabled;
         HistoryLength.Text              = _Settings.PageViewTrackingDays.ToString();
         CurrentRecords.Text             = PageViewDataSource.CountAll().ToString();
         SaveArchive.SelectedIndex       = (_Settings.PageViewTrackingSaveArchive ? 1 : 0);
         SaveArchiveWarningPanel.Visible = (SaveArchive.SelectedIndex == 1);
         GoogleUrchinId.Text             = _Settings.GoogleUrchinId;
         EnablePageTracking.Checked      = _Settings.EnableGoogleAnalyticsPageTracking;
         EnableEcommerceTracking.Checked = _Settings.EnableGoogleAnalyticsEcommerceTracking;
         ActivityDateUpdateInterval.Text = _Settings.ActivityDateUpdateInterval.ToString();
     }
     ResponseMessageGA.Visible = false;
     ResponseMessage.Visible   = false;
 }
Esempio n. 3
0
 protected void ClearButton_Click(object sender, EventArgs e)
 {
     PageViewDataSource.DeleteAll();
     CurrentRecords.Text = PageViewDataSource.CountAll().ToString();
 }