Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SalesOrderDataAccess db  = new SalesOrderDataAccess();
            var           orders     = db.GetAllOrders();
            var           customers  = orders.Select(order => order.CustomerName).ToArray();
            var           netAmount  = orders.Select(order => order.TotalSum).ToList();
            var           netTax     = orders.Select(order => order.Tax).ToList();
            List <object> amount     = new List <object>();
            List <object> tax        = new List <object>();
            List <object> categories = new List <object>();


            netAmount.ForEach(delegate(decimal net)
            {
                amount.Add((object)net);
            });

            netTax.ForEach(delegate(decimal net)
            {
                tax.Add((object)net);
            });


            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart
            {
                Height            = 300,
                Width             = 600,
                DefaultSeriesType = ChartTypes.Line,
                ClassName         = "chart"
            })
                                                 .SetTitle(new Title
            {
                Text = "Sales Orders By Company",
                X    = -20
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = customers
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "In Dollars"
                },
            })
                                                 .SetSeries(new Series[]
            {
                new Series {
                    Name = "Amount", Data = new Data(amount.ToArray())
                },
                new Series {
                    Name = "Tax", Data = new Data(tax.ToArray())
                },
            });

            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 2
0
        public void SetGraph()
        {
            List <cstPackingTime> lsShipInfo = Obj.call.GetPackingTimeQuantity();

            String[] Sarray = new string[lsShipInfo.Count];
            object[] Times  = new object[lsShipInfo.Count];
            for (int i = 0; i <= lsShipInfo.Count - 1; i++)
            {
                Sarray[i] = lsShipInfo[i].ShippingNumber.ToString();
                String   s      = lsShipInfo[i].TimeSpend.ToString();
                String[] t      = s.Split(new char[] { ':', 'H', 'S', 'M' });
                String   timess = t[2].Trim() + "." + t[4].Trim();
                Decimal  D      = Convert.ToDecimal(timess);
                Times[i] = Math.Round(D, 2);
            }

            #region Graph

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart
            {
                Type = ChartTypes.Line
            })
                                                 .SetTitle(new Title
            {
                Text = "Shipment packing Time"
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = Sarray,
                Title      = new XAxisTitle {
                    Text = "Shipment Numbers"
                },
                Min = 10
            })
                                                 .SetLegend(new Legend
            {
                VerticalAlign = VerticalAligns.Bottom
            })

                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Time in (Min.Sec)"
                }
            })
                                                 .SetSeries(new Series
            {
                Data = new Data(Times),
                Name = "Time Taken"
            });

            #endregion

            ltrChart.Text = chart.ToHtmlString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SalesOrderDataAccess db = new SalesOrderDataAccess();
            var orders = db.GetAllOrders();
            var customers = orders.Select(order => order.CustomerName).ToArray();
            var netAmount = orders.Select(order => order.TotalSum).ToList();
            var netTax = orders.Select(order => order.Tax).ToList();
            List<object> amount = new List<object>();
            List<object> tax = new List<object>();
            List<object> categories = new List<object>();

            netAmount.ForEach(delegate(decimal net)
            {
                amount.Add((object)net);
            });

            netTax.ForEach(delegate(decimal net)
            {
                tax.Add((object)net);
            });

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
            .InitChart(new Chart
            {
                Height = 300,
                Width = 600,
                DefaultSeriesType = ChartTypes.Line,
                ClassName = "chart"
            })
            .SetTitle(new Title
                          {
                              Text = "Sales Orders By Company",
                              X = -20
                          })
            .SetXAxis(new XAxis
            {
                Categories = customers
            })
            .SetYAxis(new YAxis
            {
                Title = new YAxisTitle { Text = "In Dollars" },
            })
            .SetSeries(new Series[]
            {
                new Series { Name = "Amount", Data = new Data(amount.ToArray()) },
                new Series { Name = "Tax", Data = new Data(tax.ToArray()) },
            });

            ltrChart.Text = chart.ToHtmlString();
        }
        public void SetGraph()
        {
            List <cstStationToatlPacked> _lsTotalPacekedPerStation = Obj.Rcall.GetStationTotalPaked();

            gvStationInfo.DataSource = _lsTotalPacekedPerStation.ToList();
            gvStationInfo.DataBind();

            Series[] sr = new Series[_lsTotalPacekedPerStation.Count];

            // chart Veriables
            String[] StationNames = new string[_lsTotalPacekedPerStation.Count];

            for (int i = 0; i < _lsTotalPacekedPerStation.Count; i++)
            {
                sr[i] = new Series {
                    Name = _lsTotalPacekedPerStation[i].StationName, Data = new Data(new object[] { _lsTotalPacekedPerStation[i].TotalPacked, _lsTotalPacekedPerStation[i].PartiallyPacked })
                };
            }

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("Chart")
                                                 .InitChart(new DotNet.Highcharts.Options.Chart
            {
                Type            = ChartTypes.Bar,
                BackgroundColor = new BackColorOrGradient(System.Drawing.Color.White),
                Height          = 400,
            })
                                                 .SetXAxis(new DotNet.Highcharts.Options.XAxis
            {
                Categories = (new string[] { "Packed", "Partially Packed" }),
                Title      = new XAxisTitle {
                    Text = "Packi", Style = "fontSize: '15px', fontFamily: 'Verdana', color: 'Black'"
                }
            })
                                                 .SetTitle(new Title
            {
                Text  = "Station Information ",
                Style = "fontSize: '30px',fontFamily: 'Verdana', fontBold: 'true', color: 'Black' "
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Staion Names", Style = "fontSize: '15px', fontFamily: 'Verdana', color: 'Black'"
                },
            })
                                                 .SetSeries(sr);

            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .SetXAxis(new XAxis
            {
                Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            })
                                                 .SetSeries(new Series
            {
                Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
            });

            string text = chart.ToHtmlString();

            System.IO.File.AppendAllText(@"C:\Users\Ben\Desktop\chart.html", text);
        }
Exemplo n.º 6
0
        protected void Render_Chart(string name)
        {
            string[] created_time = created_time1.Select(a => a).ToArray();
            object[] _like        = Array.ConvertAll(likes, x => (object)x);
            object[] _comments    = Array.ConvertAll(Comments, x => (object)x);
            object[] _links       = Array.ConvertAll(link, x => (object)x);
            Array.Reverse(created_time);
            Array.Reverse(_like);
            Array.Reverse(_comments);
            Array.Reverse(link);
            string sear = searchBox.Text;

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart").InitChart(new Chart {
                ZoomType = ZoomTypes.X, SpacingRight = 20, DefaultSeriesType = ChartTypes.Line
            })

                                                 .SetTitle(new Title
            {
                Text = "Instagram " + " for: " + UserName,
                X    = -20
            })
                                                 .SetSubtitle(new Subtitle
            {
                Text = "Click and drag in the plot area to zoom in ",
                X    = -20
            }).SetXAxis(new XAxis
            {
                Categories = new[] { ConvertToString(created_time) },
                Labels     = new XAxisLabels
                {
                    Step = null
                }
            })
                                                 .SetSeries(new[] {
                new Series {
                    Type = ChartTypes.Spline, Data = new Data(_like), Name = "likes:",
                },
                new Series {
                    Type = ChartTypes.Column, Data = new Data(_comments), Name = "comments:",
                },
            }
                                                            );

            ltChart1.Text     = chart.ToHtmlString();
            ExportCSV.Visible = true;
            Result.Visible    = true;
        }
        /// <summary>
        /// Creates the Html for a Chart using Restore data
        /// </summary>
        /// <returns></returns>
        public string RestoreByNuGetVersionChart()
        {
            string[]      blobNames = { "Restore7Day.json", "Restore-Dependency7Day.json" };
            List <string> xValues   = new List <string>();
            List <object> yValues   = new List <Object>();

            ReportHelpers.GetValuesFromBlobs(blobNames, StorageAccount, ContainerName, out xValues, out yValues);

            List <DotNet.Highcharts.Options.Series> seriesSet = new List <DotNet.Highcharts.Options.Series>();

            seriesSet.Add(new DotNet.Highcharts.Options.Series
            {
                Data = new Data(yValues.ToArray())
            });

            DotNet.Highcharts.Highcharts installChart = ReportHelpers.GetBarChart(seriesSet, xValues, "Restores_Per_NuGet_Version");
            string installChartHtml = installChart.ToHtmlString();

            return(installChartHtml);
        }
Exemplo n.º 8
0
        private void loadSummaryPieChart()
        {
            queryString = "select count(*) as count, CASE greatest(Neutral,Happy,Sad,Angry,Surprised,Scared,Disgusted)" +
                          " WHEN Neutral THEN 'Neutral'" +
                          " WHEN Happy THEN 'Happy'" +
                          " WHEN Sad THEN 'Sad'" +
                          " WHEN Angry THEN 'Angry'" +
                          " WHEN Surprised THEN 'Surprised'" +
                          " WHEN Scared THEN 'Scared'" +
                          " WHEN Disgusted THEN 'Disgusted'" +
                          " else 'Unknown'" +
                          " END AS maxColumn from alef.emotions where Student_id=" + studentId +
                          " and Timestamp BETWEEN " + start + " AND " + end + " group by maxColumn;";

            DataTable data              = loadDatafromDB(queryString);
            var       percentages       = new List <object[]>();
            double    totalNumOfRecords = 0;

            foreach (DataRow dr in data.Rows)
            {
                totalNumOfRecords += Convert.ToDouble(dr["count"]);
            }

            foreach (DataRow dr in data.Rows)
            {
                double percentage = Math.Round((((Convert.ToDouble(dr["count"])) / totalNumOfRecords) * 100.0), 2);
                percentages.Add(new object[] { dr["maxColumn"].ToString(), percentage.ToString() });
            }

            Title title = new DotNet.Highcharts.Options.Title();

            title.Text = "";

            DotNet.Highcharts.Highcharts chart2 = new DotNet.Highcharts.Highcharts("chart2").SetTitle(title);
            chart2.SetSeries(new Series
            {
                Type = DotNet.Highcharts.Enums.ChartTypes.Pie,
                Data = new Data(percentages.ToArray())
            });
            ltrChart2.Text = chart2.ToHtmlString();
        }
Exemplo n.º 9
0
        private void generateGraph(ConfigDAO configs, Literal literal)
        {
            DataTable data = loadDatafromDB(queryString);

            Object[] intensities = new Object[data.Rows.Count];
            string[] timestamps  = new string[data.Rows.Count];
            int      index       = 0;

            foreach (DataRow dr in data.Rows)
            {
                intensities[index] = (dr[configs.emotion].ToString() != "") ? dr[configs.emotion] : null;
                timestamps[index]  = dr["Timestamp"].ToString();
                index++;
            }

            Series[] serieses   = new Series[1];
            Series   dataSeries = new Series {
                Data = new Data(intensities)
            };

            dataSeries.Color = configs.color;
            dataSeries.Name  = configs.emotion;
            serieses[0]      = dataSeries;

            Title title = new DotNet.Highcharts.Options.Title();

            title.Text = configs.graphTitle;

            XAxis xAxis = new XAxis();

            xAxis.Categories   = timestamps;
            xAxis.TickInterval = 200;

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts(configs.chartName).SetXAxis(xAxis).SetSeries(serieses).SetTitle(title);
            literal.Text = chart.ToHtmlString();
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /* get data
             */
            DataTable dt = PostOrmDB.GetTop10MentionKeyword();

            var query = dt.AsEnumerable()
                .GroupBy(row => new
                {
                    Text = row.Field<string>("keyword_value"),
                    Keyword = row.Field<int>("KeywordId"),
                    Senti = row.Field<int>("SentiLabel")
                })
                .Select(grp => new
                {
                    Text = grp.Key.Text,
                    Keyword = grp.Key.Keyword,
                    Senti = grp.Key.Senti,
                    Count = grp.Count()
                });

            List<string> ltext = new List<string>();
            List<string> lkeyword = new List<string>();
            List<int> lpos = new List<int>();
            List<int> lnor = new List<int>();
            List<int> lneg = new List<int>();

            /*
             * get value of pos/nor/neg
             */
            /*
            foreach (var senti in query)
            {
                    if (!lkeyword.Contains(senti.Keyword.ToString()))
                    {
                        lkeyword.Add(senti.Keyword.ToString());

                        if (senti.Senti == 0 || senti.Senti == 1)
                        {
                            lneg.Add(senti.Count);
                        }
                        else{
                            lneg.Add(0);
                        }
                        if (senti.Senti == 2)
                        {
                            lnor.Add(senti.Count);
                        }
                        else{
                            lnor.Add(0);
                        }

                        if (senti.Senti == 3 || senti.Senti == 4)
                        {
                            lpos.Add(senti.Count);
                        }
                        else
                        {
                            lpos.Add(0);
                        }

                    }
                    else
                    {
                        if (senti.Senti == 0 || senti.Senti == 1)
                        {
                            lneg[lneg.Count-1]=senti.Count;
                        }

                        if (senti.Senti == 2)
                        {
                            lnor[lnor.Count - 1] = senti.Count;
                        }

                        if (senti.Senti == 3 || senti.Senti == 4)
                        {
                            lpos[lpos.Count - 1] = senti.Count;
                        }

                    }

            }
             * */

            foreach (var senti in query)
            {
                if (!ltext.Contains(senti.Text))
                {
                    ltext.Add(senti.Text);

                    if (senti.Senti == 0 || senti.Senti == 1)
                    {
                        lneg.Add(senti.Count);
                    }
                    else
                    {
                        lneg.Add(0);
                    }
                    if (senti.Senti == 2)
                    {
                        lnor.Add(senti.Count);
                    }
                    else
                    {
                        lnor.Add(0);
                    }

                    if (senti.Senti == 3 || senti.Senti == 4)
                    {
                        lpos.Add(senti.Count);
                    }
                    else
                    {
                        lpos.Add(0);
                    }

                }
                else
                {
                    if (senti.Senti == 0 || senti.Senti == 1)
                    {
                        lneg[lneg.Count - 1] = senti.Count;
                    }

                    if (senti.Senti == 2)
                    {
                        lnor[lnor.Count - 1] = senti.Count;
                    }

                    if (senti.Senti == 3 || senti.Senti == 4)
                    {
                        lpos[lpos.Count - 1] = senti.Count;
                    }

                }

            }

            List<string> lstr = new List<string>();
            /*
            foreach (var item in lkeyword)
            {
                lstr.Add(item.ToString());
            }
            */
            foreach (var item in ltext)
            {
                lstr.Add(item);
            }

            //string[] o_keyword = lstr.ToArray();
            string[] o_text = lstr.ToArray();
            object[] o_neg = lneg.Cast<object>().ToArray();
            object[] o_nor = lnor.Cast<object>().ToArray();
            object[] o_pos = lpos.Cast<object>().ToArray();

            /* Display chart
             *
             */
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
            .InitChart(new Chart { DefaultSeriesType = DotNet.Highcharts.Enums.ChartTypes.Bar })
            .SetTitle(new Title { Text = "Distribution of Top 10 Keywords In A Week" })
            //.SetXAxis(new XAxis { Categories = o_keyword })
            .SetXAxis(new XAxis { Categories = o_text })
            .SetPlotOptions(new PlotOptions { Column = new PlotOptionsColumn { Stacking = Stackings.Normal } })
            .SetSeries(new[]
                       {
                           new Series { Name = "Negative", Data = new Data(o_neg) },
                           new Series { Name = "Normal", Data = new Data(o_nor) },
                           new Series { Name = "Positive", Data = new Data(o_pos) }
                       });

            huyChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 11
0
        protected void Render_Chart()
        {
            //initialising sql variables
            string        constring;
            SqlConnection myConn;
            string        commandText;
            SqlCommand    myComm;
            SqlDataReader reader;


            double        Budget            = 80000;
            StringBuilder Periodbuildstring = new StringBuilder();
            StringBuilder databuildstring   = new StringBuilder();
            StringBuilder fieldbuildstring  = new StringBuilder();



            //get the data for the period and other parameters in arrray                        done
            //call optimiser and it will give optspends                                         done
            //initalise the highchart and generate the graph                                    done
            //save the data to the campaign table for the campaign created
            //save the data to the other media table (campaign id, spendouts )etc fields



            //getting the data from the database
            constring   = WebConfigurationManager.ConnectionStrings["phasingSQL"].ToString();
            myConn      = new SqlConnection(constring);
            commandText = "select period, Salesbase, carryover, Upliftmax, spendhalf from MediaChannelPlan";
            myComm      = new SqlCommand(commandText, myConn);
            myConn.Open();
            reader = myComm.ExecuteReader();


            Periodbuildstring.Append(",\\,");
            databuildstring.Append(",,,,\\,");


            //Creating the Fields Input
            string Fields    = ",Period,SalesBase,Carryover,UpliftMax,SpendHalf";
            char   delimiter = ',';

            string[] FieldsInput = Fields.Split(delimiter);


            Object[] chartValues = new Object[6]; // declare an object for the chart rendering
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Periodbuildstring.Append(reader["Period"]);
                    Periodbuildstring.Append("\\,");
                    databuildstring.Append(reader["SalesBase"]);
                    databuildstring.Append(",");
                    databuildstring.Append(reader["Carryover"]);
                    databuildstring.Append(",");
                    databuildstring.Append(reader["UpliftMax"]);
                    databuildstring.Append(",");
                    databuildstring.Append(reader["SpendHalf"]);
                    databuildstring.Append("\\,");
                }
            }


            //Creating the Text data
            Periodbuildstring.Remove(Periodbuildstring.Length - 2, 2);
            string TextData     = Periodbuildstring.ToString();
            char   txtdelimiter = '\\';

            string[] TextRows = TextData.Split(txtdelimiter);

            char delimit = ',';

            string[,] TextInput = new string[TextRows.Count(), TextRows[0].Split(delimit).Count()];
            for (int i = 0; i < TextRows.Count(); i++)
            {
                for (int j = 1; j < TextRows[i].Split(delimit).Count(); j++)
                {
                    TextInput[i, j] = TextRows[i].Split(delimit)[j];
                }
            }



            //Creating the Numeric data
            databuildstring.Remove(databuildstring.Length - 2, 2);
            string NumData      = databuildstring.ToString();
            char   numdelimiter = '\\';

            string[] NumRows = NumData.Split(numdelimiter);


            double[,] NumInput = new double[NumRows.Count(), TextRows[0].Split(delimit).Count() + 3];
            for (int i = 0; i < NumRows.Count(); i++)
            {
                for (int j = 1; j < NumRows[i].Split(delimit).Count(); j++)
                {
                    if (NumRows[i].Split(delimit)[j] == "")
                    {
                        NumInput[i, j] = double.NaN;
                    }
                    else
                    {
                        NumInput[i, j] = Convert.ToDouble(NumRows[i].Split(delimit)[j]);
                    }
                }
            }


            //Calling the Optimiser and setting Inputs and creating Optimising the budget
            Optimiser.Opt testOpt = new Optimiser.Opt();
            string        optSuccess;

            optSuccess = testOpt.SetInputs(FieldsInput, TextInput, NumInput).ToString();
            optSuccess = testOpt.Optimise(Budget);

            double[] result = testOpt.GetOptSpends();

            for (int i = 0; i < result.Length - 1; i++)
            {
                chartValues[i] = result[i];
            }


            //Declaring Highchart chart and creating the Highcharts
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart
            {
                DefaultSeriesType = ChartTypes.Column
            })
                                                 .SetTitle(new Title
            {
                //Text = "Monthly Number of Pizza",
                Text = "Monthly Budget",

                X = -20
            })
                                                 .SetSubtitle(new Subtitle
            {
                Text = "Source: Mindshare database",
                X    = -20
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = new[] { "W1", "W2", "W3", "W4", "W5", "W6" }
            })
                                                 .SetPlotOptions(new PlotOptions {
                Column = new PlotOptionsColumn {
                    Stacking = Stackings.Normal
                }
            })
                                                 .SetSeries(new[]
            {
                //Name = "# Pizza",
                //Data = new Data(chartValues)   // Here we put the dbase data into the chart
                new Series {
                    Name = "Ads ON TV", Data = new Data(chartValues)
                },
                new Series {
                    Name = "Newspaper ADS", Data = new Data(chartValues)
                },
                new Series {
                    Name = "Magazine Ads", Data = new Data(chartValues)
                },
                new Series {
                    Name = "Social Networking Ads", Data = new Data(chartValues)
                }
            });

            chrtMyChart.Text = chart.ToHtmlString(); // Let's visualize the chart into the webform.
        }
Exemplo n.º 12
0
        protected void Render_Chart()
        {
            // define the connection string
            string constringpm = "Data Source=192.168.112.10;Initial Catalog=AI_10143;User ID=sa;Password=10143";
            string constringcw = "Data Source=192.168.111.10;Initial Catalog=AI_10112;User ID=sa;Password=10112";
            string constringnk = "Data Source=192.168.114.10;Initial Catalog=AI_10115;User ID=sa;Password=10115";
            string constringbn = "Data Source=192.168.115.10;Initial Catalog=AI_10126;User ID=sa;Password=10126";

            // Declare the SQL connection

            SqlConnection myConnpm = new SqlConnection(constringpm);
            // and add a query string for retrieving the data.
            //string commandText = "select period, count(pizza) from pizzaDB group by period order by period";
            string     commandTextpm = "SELECT MONTH(BOOKING_DATE) ,COUNT([BOOKING_NO]) FROM [Vgh-ids-Booking] where YEAR(BOOKING_DATE) = '2019' group by  MONTH(BOOKING_DATE) order by  MONTH(BOOKING_DATE) asc";
            SqlCommand myCommpm      = new SqlCommand(commandTextpm, myConnpm);

            // Open the connection
            myConnpm.Open();

            // and execute the query
            SqlDataReader readerpm = myCommpm.ExecuteReader();

            Object[] chartValuespm = new Object[12]; // declare an object for the chart rendering
            if (readerpm.HasRows)
            {
                while (readerpm.Read())
                {
                    // GetValue() returns the data row from the query
                    // So:
                    //       GetValue(0) will contain the month number [<em>month(eaten_Pizza) as Mese</em>]
                    //       GetValue(1) will contain the number of eaten pizzas [<em>count(eaten_Pizza)</em>]

                    chartValuespm[(Int32)readerpm.GetValue(0) - 1] = readerpm.GetValue(1);
                    // minus 1 because the array starts from 0, whenever the months start from 1
                }
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            readerpm.Close(); // close the reader

            // Declare the SQL connection

            SqlConnection myConncw = new SqlConnection(constringcw);
            // and add a query string for retrieving the data.
            //string commandText = "select period, count(pizza) from pizzaDB group by period order by period";
            string     commandTextcw = "SELECT MONTH(BOOKING_DATE) ,COUNT([BOOKING_NO]) FROM [Vgh-ids-Booking] where YEAR(BOOKING_DATE) = '2019' group by  MONTH(BOOKING_DATE) order by  MONTH(BOOKING_DATE) asc";
            SqlCommand myCommcw      = new SqlCommand(commandTextcw, myConncw);

            // Open the connection
            myConncw.Open();

            // and execute the query
            SqlDataReader readercw = myCommcw.ExecuteReader();

            Object[] chartValuescw = new Object[12]; // declare an object for the chart rendering
            if (readercw.HasRows)
            {
                while (readercw.Read())
                {
                    // GetValue() returns the data row from the query
                    // So:
                    //       GetValue(0) will contain the month number [<em>month(eaten_Pizza) as Mese</em>]
                    //       GetValue(1) will contain the number of eaten pizzas [<em>count(eaten_Pizza)</em>]

                    chartValuescw[(Int32)readercw.GetValue(0) - 1] = readercw.GetValue(1);
                    // minus 1 because the array starts from 0, whenever the months start from 1
                }
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            readercw.Close(); // close the reader

            // Declare the SQL connection

            SqlConnection myConnnk = new SqlConnection(constringnk);
            // and add a query string for retrieving the data.
            //string commandText = "select period, count(pizza) from pizzaDB group by period order by period";
            string     commandTextnk = "SELECT MONTH(BOOKING_DATE) ,COUNT([BOOKING_NO]) FROM [Vgh-ids-Booking] where YEAR(BOOKING_DATE) = '2019' group by  MONTH(BOOKING_DATE) order by  MONTH(BOOKING_DATE) asc";
            SqlCommand myCommnk      = new SqlCommand(commandTextnk, myConnnk);

            // Open the connection
            myConnnk.Open();

            // and execute the query
            SqlDataReader readernk = myCommnk.ExecuteReader();

            Object[] chartValuesnk = new Object[12]; // declare an object for the chart rendering
            if (readernk.HasRows)
            {
                while (readernk.Read())
                {
                    // GetValue() returns the data row from the query
                    // So:
                    //       GetValue(0) will contain the month number [<em>month(eaten_Pizza) as Mese</em>]
                    //       GetValue(1) will contain the number of eaten pizzas [<em>count(eaten_Pizza)</em>]

                    chartValuesnk[(Int32)readernk.GetValue(0) - 1] = readernk.GetValue(1);
                    // minus 1 because the array starts from 0, whenever the months start from 1
                }
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            readernk.Close(); // close the reader

            // Declare the SQL connection

            SqlConnection myConnbn = new SqlConnection(constringbn);
            // and add a query string for retrieving the data.
            //string commandText = "select period, count(pizza) from pizzaDB group by period order by period";
            string     commandTextbn = "SELECT MONTH(BOOKING_DATE) ,COUNT([BOOKING_NO]) FROM [Vgh-ids-Booking] where YEAR(BOOKING_DATE) = '2019' group by  MONTH(BOOKING_DATE) order by  MONTH(BOOKING_DATE) asc";
            SqlCommand myCommbn      = new SqlCommand(commandTextbn, myConnbn);

            // Open the connection
            myConnbn.Open();

            // and execute the query
            SqlDataReader readerbn = myCommbn.ExecuteReader();

            Object[] chartValuesbn = new Object[12]; // declare an object for the chart rendering
            if (readerbn.HasRows)
            {
                while (readerbn.Read())
                {
                    // GetValue() returns the data row from the query
                    // So:
                    //       GetValue(0) will contain the month number [<em>month(eaten_Pizza) as Mese</em>]
                    //       GetValue(1) will contain the number of eaten pizzas [<em>count(eaten_Pizza)</em>]

                    chartValuesbn[(Int32)readerbn.GetValue(0) - 1] = readerbn.GetValue(1);
                    // minus 1 because the array starts from 0, whenever the months start from 1
                }
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            readerbn.Close(); // close the reader


            // Declare the HighCharts object
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart").InitChart(new Chart {
                DefaultSeriesType = ChartTypes.Column
            })
                                                 .SetTooltip(new Tooltip
            {
                //HeaderFormat = "",
                //PointFormat = "",
                //FooterFormat = "",
                //        <tr><td style="color:{series.color};padding:0">{series.name}: </ td > ' +
                //'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>'
                Enabled = true,
                UseHTML = true,
                Shared  = true
            })

                                                 .SetPlotOptions(new PlotOptions
            {
                Column = new PlotOptionsColumn
                {
                    PointPadding = 0.2,
                    BorderWidth  = 0
                }
            })
                                                 .SetTitle(new Title
            {
                Text = "Booking in Monthly",
                X    = -20
            })

                                                 .SetSubtitle(new Subtitle
            {
                Text = "Source: Booking DB",
                X    = -20
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "จำนวน Booking", Style = "background: '#ffffff'"
                }
            })
                                                 .SetSeries(new[]
            {
                new Series
                {
                    Name = "ปากเกร็ด-เมืองทอง",
                    Data = new Data(chartValuespm)   // Here we put the dbase data into the chart
                },
                new Series
                {
                    Name = "แจ้งวัฒนะ",
                    Data = new Data(chartValuescw)   // Here we put the dbase data into the chart
                },
                new Series
                {
                    Name = "หนองแขม",
                    Data = new Data(chartValuesnk)   // Here we put the dbase data into the chart
                },
                new Series
                {
                    Name = "บางกอกน้อย",
                    Data = new Data(chartValuesbn)   // Here we put the dbase data into the chart
                }
            });


            container.InnerHtml = chart.ToHtmlString(); // Let's visualize the chart into the webform.
        }
Exemplo n.º 13
0
        protected void Calculate(object sender, EventArgs e)
        {
            double L,C,A;
            var mydata = new ArrayList();
                ;

            /*
            if (Inductance.Text.Length > 0 && Capacitance.Text.Length > 0)
            {

                A = Convert.ToDouble(Inductance.Text) + Convert.ToDouble(Capacitance.Text);
                Answer.Text = A.ToString("0.000");
            }
            else
            {
                Answer.Text = "Invalid Input";
            }
            //Debug.Write("Calculate Pressed\n");
             *
             * */
            //s = Inductance.Text;
            //C = Double.TryParse(s, L);
            if (Double.TryParse(Inductance.Text, out L))
            {
            }
            if( (Double.TryParse(Capacitance.Text,out  C))&&(Double.TryParse(Inductance.Text, out L)))
            {
               //A = L + C;
                A =  1.0 / (6.2831853 * Math.Sqrt(L * C/1000));
                Answer.Text = A.ToString("0.000") + " MHz";
                for( int i = 0; i < 10; i++ ) {
                    //mydata.Add(1.0 * i);
                    mydata.Add( 1.0 / (6.2831853 * Math.Sqrt(L * C/1000 * 0.2 * (i+1))));
                }

            } else
            {
                Answer.Text = "Invalid Input";
            }
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                .InitChart(new Chart
                    {
                        DefaultSeriesType = ChartTypes.Line,
                        Height = 300,
                        MarginRight = 130,
                        //MarginBottom = 25,
                        ClassName = "chart"
                    })
                .SetTitle(new Title
                {
                    Text = "Resonant Frequency",
                    X = -20
                })

                .SetXAxis(new XAxis
                {
                    Categories = new[] { "20%","40%","60%","80%","100%","120%","140%","160%","180%","200%" },
                    //Categories = mydata;
                    Title = new XAxisTitle {Text =  "% Capacitance"},
                    Min = 0,
                    Max = 9,
                    //TickLength = 20,
                    //TickWidth = 20,
                    //MinTickInterval = 20
                    TickInterval = 1
                }
                )
                .SetYAxis(new YAxis
                    {
                        Title = new YAxisTitle { Text = "Frequency MHz" },
                        PlotLines = new []
                        {
                            new YAxisPlotLines
                            {

                                    Value = 0,
                                    Width = 1,
                                    //Color = ColorTranslator.FromHtml("808080")

                            }
                        }
                    }
                        )
                .SetSeries(new Series
                {
                   // Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
                    //Data = new Data(new object mydata);

                    Data = new Data(new object[] { mydata[0], mydata[1], mydata[2], mydata[3], mydata[4],
                    mydata[5],mydata[6], mydata[7], mydata[8], mydata[9]})
                });
            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 14
0
        private void loadEmotionGraph()
        {
            queryString = "select Neutral,Happy,Sad,Angry,Surprised,Scared,Disgusted,Timestamp from alef.emotions where Student_id= "
                          + studentId + " and Timestamp BETWEEN " + start + " AND " + end + "; ";

            DataTable data = loadDatafromDB(queryString);

            Object[] neutralIntensities   = new Object[data.Rows.Count];
            Object[] happyIntensities     = new Object[data.Rows.Count];
            Object[] sadIntensities       = new Object[data.Rows.Count];
            Object[] angryIntensities     = new Object[data.Rows.Count];
            Object[] surprisedIntensities = new Object[data.Rows.Count];
            Object[] scaredIntensities    = new Object[data.Rows.Count];
            Object[] disgustedIntensities = new Object[data.Rows.Count];
            string[] timestamps           = new string[data.Rows.Count];

            int index = 0;

            foreach (DataRow dr in data.Rows)
            {
                neutralIntensities[index]   = (dr["Neutral"].ToString() != "") ? dr["Neutral"] : null;
                happyIntensities[index]     = (dr["Happy"].ToString() != "") ? dr["Happy"] : null;
                sadIntensities[index]       = (dr["Sad"].ToString() != "") ? dr["Sad"] : null;
                angryIntensities[index]     = (dr["Angry"].ToString() != "") ? dr["Angry"] : null;
                surprisedIntensities[index] = (dr["Surprised"].ToString() != "") ? dr["Surprised"] : null;
                scaredIntensities[index]    = (dr["Scared"].ToString() != "") ? dr["Scared"] : null;
                disgustedIntensities[index] = (dr["Disgusted"].ToString() != "") ? dr["Disgusted"] : null;
                timestamps[index]           = dr["Timestamp"].ToString();
                index++;
            }

            Series[] serieses = new Series[7];

            Series neutralDataSeries = new Series {
                Data = new Data(neutralIntensities)
            };

            neutralDataSeries.Name = "Neutral";

            Series happyDataSeries = new Series {
                Data = new Data(happyIntensities)
            };

            happyDataSeries.Name = "Happy";

            Series sadDataSeries = new Series {
                Data = new Data(sadIntensities)
            };

            sadDataSeries.Name = "Sad";

            Series angryDataSeries = new Series {
                Data = new Data(angryIntensities)
            };

            angryDataSeries.Name = "Angry";

            Series surprisedDataSeries = new Series {
                Data = new Data(surprisedIntensities)
            };

            surprisedDataSeries.Name = "Surprised";

            Series scaredDataSeries = new Series {
                Data = new Data(scaredIntensities)
            };

            scaredDataSeries.Name = "Scared";

            Series disgustedDataSeries = new Series {
                Data = new Data(disgustedIntensities)
            };

            disgustedDataSeries.Name = "Disgusted";

            serieses[0] = neutralDataSeries;
            serieses[1] = happyDataSeries;
            serieses[2] = sadDataSeries;
            serieses[3] = angryDataSeries;
            serieses[4] = surprisedDataSeries;
            serieses[5] = scaredDataSeries;
            serieses[6] = disgustedDataSeries;

            Title title = new DotNet.Highcharts.Options.Title();

            title.Text = "Emotion Summary";

            XAxis xAxis = new XAxis();

            xAxis.Categories   = timestamps;
            xAxis.TickInterval = 200;

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart1").SetXAxis(xAxis).SetSeries(serieses).SetTitle(title);
            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 15
0
        // GET: ChartDemo
        public ActionResult Index()
        {
            var table = new DataTable();
            var dt    = @"select FirstName +' '+ LastName UserName,sum(AmountOfSales) Count from Users u  
inner join Sales s on  s.UserId=u.UserId 
Where s.IsApproved=1
group by FirstName,LastName order by Count desc";

            using (var dbx = new BayiPuanContext())
            {
                var cmd = dbx.Database.Connection.CreateCommand();
                var sql = dt;
                cmd.CommandText = sql;
                cmd.Connection.Open();
                table.Load(cmd.ExecuteReader());
                DataSet ds = new DataSet();
                ds.Tables.Add(table);

                DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                     .InitChart(new Chart
                {
                    DefaultSeriesType = ChartTypes.Column
                })

                                                     .SetTitle(new Title
                {
                    Text = "Satış Raporu"
                })
                                                     .SetXAxis(new XAxis
                {
                    //Categories = new[] { "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" }
                    Categories = table.AsEnumerable().Select(r => r.Field <string>("UserName").ToString()).ToArray()
                })
                                                     .SetYAxis(new YAxis
                {
                    Title = new YAxisTitle {
                        Text = "Satılan Ürün Miktarı"
                    },
                    PlotLines = new[]
                    {
                        new YAxisPlotLines
                        {
                            Value = 0,
                            Width = 1,
                            Color = ColorTranslator.FromHtml("#808080")
                        }
                    }
                })
                                                     .SetSeries(
                    new Series[] {
                    new Series
                    {
                        Name = "Satılan", Data = new Data(
                            table.AsEnumerable().Select(r => r.Field <int>("Count")).Cast <object>().ToArray()
                            )
                    }
                }
                    );
                ViewData["chart"] = chart.ToHtmlString();
                return(View());
            }
        }
Exemplo n.º 16
0
 private void plotRAMData()
 {
     //RAM graph
     DotNet.Highcharts.Highcharts RAMChart = new DotNet.Highcharts.Highcharts("chart1").InitChart(new Chart
     {
         ZoomType = DotNet.Highcharts.Enums.ZoomTypes.Y,
         Type     = DotNet.Highcharts.Enums.ChartTypes.Columnrange,
         Inverted = true
     })
                                             .SetXAxis(new[] {
         new XAxis
         {
             Type     = DotNet.Highcharts.Enums.AxisTypes.Linear,
             Max      = 350,
             Reversed = false,
             Title    = new XAxisTitle {
                 Text = "Dose values [µGy]"
             }
         }
     }).SetYAxis(new[] {
         new YAxis {
             Type  = DotNet.Highcharts.Enums.AxisTypes.Datetime,
             Title = new YAxisTitle {
                 Text = "Date"
             }
         }
     });
     RAMChart.SetTitle(new Title {
         Text = "RAM and CPD"
     })
     .SetTooltip(new Tooltip
     {
         PointFormat  = "{point.low:%e %b, %y} - {point.high:%e %b, %y}",
         HeaderFormat = "<b>{series.name}:</b>{point.x}<br />"
     });
     RAMChart.SetSeries(new[]
                        { new Series
                          {
                              Name  = "CPD",
                              Data  = new Data(cpd),
                              Color = System.Drawing.Color.Red
                          },
                          new Series
                          {
                              Name = "SM-1",
                              Data = new Data(loc1),
                          },
                          new Series
                          {
                              Name = "SM-2",
                              Data = new Data(loc2)
                          },
                          new Series
                          {
                              Name = "SM-3",
                              Data = new Data(loc3)
                          },
                          new Series
                          {
                              Name = "SM-4",
                              Data = new Data(loc4)
                          } });
     ltrRAM.Text = RAMChart.ToHtmlString();
 }
Exemplo n.º 17
0
        // GET: UserHome
        public ActionResult Index(int id)
        {
            if (User.Identity.IsAuthenticated == false || GeneralHelpers.GetUserId() != id.ToString())
            {
                return(RedirectToAction("SignOut", "Account"));
            }
            if (GeneralHelpers.GetUserId() == null || GeneralHelpers.GetUserId() == "")
            {
                return(RedirectToAction("SignIn", "Account"));
            }
            var             product  = _productQueryableRepository.Table.AsNoTracking().ToList();
            var             sale     = _saleQueryableRepository.Table.AsNoTracking().ToList();
            var             gift     = _giftQueryableRepository.Table.AsNoTracking().ToList();
            var             buyGift  = _buyQueryableRepository.Table.AsNoTracking().ToList();
            var             user     = _userQueryableRepository.Table.AsNoTracking().ToList();
            List <Campaign> campaign = _campaignQueryableRepository.Table.AsNoTracking().ToList();
            var             score    = _scroreQueryableRepository.Table.AsNoTracking().ToList();
            var             order    = 0;
            var             vm       = new ViewModel
            {
                totalWon = (from s in score

                            select new
                {
                    s.UserId,
                    s.ScoreTotal
                }).Where(p => p.UserId == id)
                           .GroupBy(w => w.UserId)
                           .Select(y => new ProductPoint
                {
                    UserId   = y.Key,
                    SumPoint = y.Sum(x => x.ScoreTotal),
                    //SumPointToMoney = y.Sum(x => x.AmountOfSales * x.Point * x.PointToMoney)
                }).ToList(),

                spentPoint = (from b in buyGift
                              join g in gift on b.GiftId equals g.GiftId
                              select new
                {
                    b.UserId,
                    b.IsApproved,
                    g.GiftPoint
                }).Where(x => x.UserId == id && x.IsApproved == true)
                             .GroupBy(w => w.UserId)
                             .Select(y => new SpentPoint()
                {
                    UserId     = y.Key,
                    SpendPoint = y.Sum(x => x.GiftPoint)
                }).ToList(),

                saleRankings = (from s in sale
                                join u in user on s.UserId equals u.UserId
                                select new
                {
                    u.UserId,
                    u.FirstName,
                    u.LastName,
                    s.AmountOfSales,
                    s.IsApproved
                }).Where(x => x.IsApproved == true).GroupBy(x => new { x.UserId, x.FirstName, x.LastName })
                               .Select(y => new SalesRanking()
                {
                    UserId    = y.Key.UserId,
                    SaleOrder = order + 1,
                    FirstName = y.Key.FirstName,
                    LastName  = y.Key.LastName,
                    SumSale   = y.Sum(x => x.AmountOfSales)
                }).AsEnumerable().OrderByDescending(x => x.SumSale)
            };

            //puan hesaplama Yöntemi
            //Yapılan satış miktarı * Puan
            //a.	Toplam kazanılan puan

            //b.	Harcanan puan
            //c.	Kalan puan
            decimal remaining        = vm.totalWon.Sum(t => t.SumPoint) - vm.spentPoint.Sum(s => s.SpendPoint);
            decimal remainingTomoney = vm.totalWon.Sum(t => t.SumPointToMoney) - vm.spentPoint.Sum(s => s.SumPointToMoney);

            vm.remainingScore        = remaining;
            vm.remainingScoreToMoney = remainingTomoney;

            //d.	Kampanya bilgileri
            vm.CampaignView = campaign;
            //e.	Duyurular
            //f.	Satış sıralamaları Chart
            var table = new DataTable();
            var dt    = @"select Top 10 FirstName +' '+ LastName UserName,sum(AmountOfSales) Count from Users u  
inner join Sales s on  s.UserId=u.UserId 
Where s.IsApproved=1
group by FirstName,LastName order by Count desc";

            using (var dbx = new BayiPuanContext())
            {
                var cmd = dbx.Database.Connection.CreateCommand();
                var sql = dt;
                cmd.CommandText = sql;
                cmd.Connection.Open();
                table.Load(cmd.ExecuteReader());
                DataSet ds = new DataSet();
                ds.Tables.Add(table);
            }
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart
            {
                DefaultSeriesType = ChartTypes.Column,
            })
                                                 .SetTitle(new Title
            {
                Text = "En İyi İlk 10"
            })
                                                 .SetXAxis(new XAxis
            {
                //Categories = new[] { "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" }
                Categories = table.AsEnumerable().Select(r => r.Field <string>("UserName").ToString()).ToArray()
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Satılan Ürün Miktarı"
                },
                PlotLines = new[]
                {
                    new YAxisPlotLines
                    {
                        Value = 0,
                        Width = 1,
                        Color = ColorTranslator.FromHtml("#808080")
                    }
                }
            })
                                                 .SetSeries(
                new Series[] {
                new Series
                {
                    Name = "Toplam Ürün Satış Sayıları", Data = new Data(
                        table.AsEnumerable().Select(r => r.Field <int>("Count")).Cast <object>().ToArray()
                        )
                }
            }
                );
            ViewData["chart"] = chart.ToHtmlString();
            return(View(vm));
        }
Exemplo n.º 18
0
        private void DrawLoginChart()
        {
            bll.Action = "LOGIN";
            DataTable dt = bll.LoginTrailsView();

            for (int x = 0; x < dt.Rows.Count; x++)
            {
                DateTime date = DateTime.Parse(dt.Rows[x][0].ToString());
                if (date.Year == DateTime.Now.Year)
                {
                    if (date.Month == 01)
                    {
                        january++;
                    }
                    if (date.Month == 02)
                    {
                        february++;
                    }
                    if (date.Month == 03)
                    {
                        march++;
                    }
                    if (date.Month == 04)
                    {
                        april++;
                    }
                    if (date.Month == 05)
                    {
                        may++;
                    }
                    if (date.Month == 06)
                    {
                        june++;
                    }
                    if (date.Month == 07)
                    {
                        july++;
                    }
                    if (date.Month == 08)
                    {
                        august++;
                    }
                    if (date.Month == 09)
                    {
                        september++;
                    }
                    if (date.Month == 10)
                    {
                        october++;
                    }
                    if (date.Month == 11)
                    {
                        november++;
                    }
                    if (date.Month == 12)
                    {
                        december++;
                    }
                }
            }

            DotNet.Highcharts.Highcharts login = new DotNet.Highcharts.Highcharts("login")

                                                 .InitChart(new Chart {
                DefaultSeriesType = ChartTypes.Line
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            })
                                                 .SetSeries(new Series
            {
                Name = "Number of Users for " + DateTime.Now.Year,
                Data = new Data(new object[] { january, february, march, april, may, june, july, august, september, october, november, december })
            })
                                                 .SetExporting(new Exporting
            {
                Enabled  = true,
                Filename = "Number of Users for " + DateTime.Now.Year
            })
                                                 .SetTitle(new Title
            {
                Text = "Number of Users for " + DateTime.Now.Year
            });
            ltrLineChart.Text = login.ToHtmlString();
        }
Exemplo n.º 19
0
        private void DrawBarChart()
        {
            DataTable     dt = bll.ServiceProviderNumberOfRatings();
            List <string> serviceProviderList = new List <string>();
            List <object> happyList           = new List <object>();
            List <object> sadList             = new List <object>();
            List <object> totalList           = new List <object>();

            for (int counter = 0; counter < dt.Rows.Count; counter++)
            {
                string rating          = dt.Rows[counter][1].ToString();
                string serviceProvider = dt.Rows[counter][2].ToString();
                if (counter != 0)
                {
                    string previousServiceProvider = dt.Rows[counter - 1][2].ToString();
                    if (counter != (dt.Rows.Count - 1))
                    {
                        string nextServiceProvider = dt.Rows[counter + 1][2].ToString();
                        if (serviceProvider != previousServiceProvider && serviceProvider != nextServiceProvider)
                        {
                            serviceProviderList.Add(dt.Rows[counter][2].ToString());
                            if (rating.Equals("happy"))
                            {
                                happyList.Add(dt.Rows[counter][0].ToString());
                                sadList.Add("0");
                            }
                            else
                            {
                                sadList.Add(dt.Rows[counter][0].ToString());
                                happyList.Add("0");
                            }
                        }
                        else if (serviceProvider == nextServiceProvider)
                        {
                            serviceProviderList.Add(dt.Rows[counter][2].ToString());
                            if (rating.Equals("happy"))
                            {
                                happyList.Add(dt.Rows[counter][0].ToString());
                                sadList.Add(dt.Rows[counter + 1][0].ToString());
                            }
                            else
                            {
                                sadList.Add(dt.Rows[counter][0].ToString());
                                happyList.Add(dt.Rows[counter + 1][0].ToString());
                            }
                        }
                    }
                }
                else if (counter == 0)
                {
                    string nextServiceProvider = bll.NumberOfRatingsPerServiceProviderAndLocation().Rows[counter + 1][2].ToString();
                    if (serviceProvider != nextServiceProvider)
                    {
                        serviceProviderList.Add(dt.Rows[counter][2].ToString());
                        if (rating.Equals("happy"))
                        {
                            happyList.Add(dt.Rows[counter][0].ToString());
                            sadList.Add("0");
                        }
                        else
                        {
                            sadList.Add(dt.Rows[counter][0].ToString());
                            happyList.Add("0");
                        }
                    }
                }
            }
            for (int a = 0; a < happyList.Count; a++)
            {
                totalList.Add(int.Parse(happyList[a].ToString()) + int.Parse(sadList[a].ToString()));
            }
            DotNet.Highcharts.Highcharts summaryRatings = new DotNet.Highcharts.Highcharts("summaryRatings")
                                                          .InitChart(new Chart
            {
                DefaultSeriesType = ChartTypes.Bar
            })
                                                          .SetXAxis(new XAxis
            {
                Categories = serviceProviderList.ToArray()
            })
                                                          .SetYAxis(new YAxis
            {
                StackLabels = new YAxisStackLabels
                {
                    Enabled = true
                }
            })
                                                          .SetPlotOptions(new PlotOptions
            {
                Bar = new PlotOptionsBar
                {
                    Stacking   = Stackings.Normal,
                    DataLabels = new PlotOptionsBarDataLabels
                    {
                        Enabled = true
                    }
                }
            })
                                                          .SetTooltip(new Tooltip
            {
                Formatter = "function () { return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal; }"
            })
                                                          .SetSeries(new[]
            {
                new Series {
                    Name = "Sad", Data = new Data(sadList.ToArray()), Color = System.Drawing.Color.FromArgb(255, 217, 30, 24)
                },
                new Series {
                    Name = "Happy", Data = new Data(happyList.ToArray()), Color = System.Drawing.Color.FromArgb(255, 244, 208, 63)
                }
            })
                                                          .SetExporting(new Exporting
            {
                Enabled  = true,
                Filename = "Summary of Ratings (" + DateTime.Now + ")"
            })
                                                          .SetTitle(new Title
            {
                Text = "Summary of Ratings (" + DateTime.Now + ")"
            });
            ltrBarChart.Text = summaryRatings.ToHtmlString();
        }
Exemplo n.º 20
0
        protected void Calculate(object sender, EventArgs e)
        {
            double L, C, A;
            var    mydata = new ArrayList();

            ;

            /*
             * if (Inductance.Text.Length > 0 && Capacitance.Text.Length > 0)
             * {
             *
             *  A = Convert.ToDouble(Inductance.Text) + Convert.ToDouble(Capacitance.Text);
             *  Answer.Text = A.ToString("0.000");
             * }
             * else
             * {
             *  Answer.Text = "Invalid Input";
             * }
             * //Debug.Write("Calculate Pressed\n");
             *
             * */
            //s = Inductance.Text;
            //C = Double.TryParse(s, L);
            if (Double.TryParse(Inductance.Text, out L))
            {
            }
            if ((Double.TryParse(Capacitance.Text, out C)) && (Double.TryParse(Inductance.Text, out L)))
            {
                //A = L + C;
                A           = 1.0 / (6.2831853 * Math.Sqrt(L * C / 1000));
                Answer.Text = A.ToString("0.000") + " MHz";
                for (int i = 0; i < 10; i++)
                {
                    //mydata.Add(1.0 * i);
                    mydata.Add(1.0 / (6.2831853 * Math.Sqrt(L * C / 1000 * 0.2 * (i + 1))));
                }
            }
            else
            {
                Answer.Text = "Invalid Input";
            }
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart
            {
                DefaultSeriesType = ChartTypes.Line,
                Height            = 300,
                MarginRight       = 130,
                //MarginBottom = 25,
                ClassName = "chart"
            })
                                                 .SetTitle(new Title
            {
                Text = "Resonant Frequency",
                X    = -20
            })

                                                 .SetXAxis(new XAxis
            {
                Categories = new[] { "20%", "40%", "60%", "80%", "100%", "120%", "140%", "160%", "180%", "200%" },
                //Categories = mydata;
                Title = new XAxisTitle {
                    Text = "% Capacitance"
                },
                Min = 0,
                Max = 9,
                //TickLength = 20,
                //TickWidth = 20,
                //MinTickInterval = 20
                TickInterval = 1
            }
                                                           )
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Frequency MHz"
                },
                PlotLines = new []
                {
                    new YAxisPlotLines
                    {
                        Value = 0,
                        Width = 1,
                        //Color = ColorTranslator.FromHtml("808080")
                    }
                }
            }
                                                           )
                                                 .SetSeries(new Series
            {
                // Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
                //Data = new Data(new object mydata);

                Data = new Data(new object[] { mydata[0], mydata[1], mydata[2], mydata[3], mydata[4],
                                               mydata[5], mydata[6], mydata[7], mydata[8], mydata[9] })
            });
            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 21
0
        private void DrawPieChart()
        {
            bll.ServiceProviderID = ddlChartServiceProvider.SelectedValue; bll.LocationID = ddlChartLocation.SelectedValue;
            DataTable     dt = bll.FilterPieChart();
            List <string> serviceProviderList = new List <string>();
            List <object> happyList           = new List <object>();
            List <object> sadList             = new List <object>();

            if (dt.Rows.Count == 2)
            {
                string rating = dt.Rows[0][1].ToString();
                if (rating.Equals("happy"))
                {
                    happyList.Add(dt.Rows[0][0].ToString());
                    sadList.Add(dt.Rows[1][0].ToString());
                }
                else
                {
                    sadList.Add(dt.Rows[0][0].ToString());
                    happyList.Add(dt.Rows[1][0].ToString());
                }
            }
            else if (dt.Rows.Count == 1)
            {
                string rating = dt.Rows[0][1].ToString();
                if (rating.Equals("happy"))
                {
                    happyList.Add(dt.Rows[0][0].ToString());
                    sadList.Add("0");
                }
                else if (rating.Equals("sad"))
                {
                    sadList.Add(dt.Rows[0][0].ToString());
                    happyList.Add("0");
                }
            }
            else
            {
                happyList.Add("0");
                sadList.Add("0");
            }

            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart {
                DefaultSeriesType = ChartTypes.Pie
            })
                                                 .SetPlotOptions(new PlotOptions
            {
                Pie = new PlotOptionsPie
                {
                    DataLabels = new PlotOptionsPieDataLabels
                    {
                        Enabled = true,
                        Format  = "<b>{point.name}</b>: {point.percentage:.0f} %",
                    }
                }
            })
                                                 .SetYAxis(new YAxis
            {
                Max = (int.Parse(happyList[0].ToString()) + int.Parse(sadList[0].ToString()))
            })
                                                 .SetTitle(new Title
            {
                Text = ddlChartServiceProvider.SelectedItem + ": " + ddlChartLocation.SelectedItem
            })
                                                 .SetSeries(new[]
            {
                new Series {
                    Name = "Ratings",
                    Data = new Data(new object[]
                    {
                        new DotNet.Highcharts.Options.Point
                        {
                            Name  = "Sad",
                            Y     = int.Parse(sadList[0].ToString()),
                            Color = System.Drawing.Color.FromArgb(255, 217, 30, 24)
                        },
                        new DotNet.Highcharts.Options.Point
                        {
                            Name     = "Happy",
                            Y        = int.Parse(happyList[0].ToString()),
                            Color    = System.Drawing.Color.FromArgb(255, 244, 208, 63),
                            Sliced   = true,
                            Selected = true
                        }
                    })
                }
            });
            ltrPieChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 22
0
        public void ShipmentCountGraph()
        {
            List <cstUserShipmentCount> _lsShipmetCount = Obj.Rcall.GetUserTotalPakedPerDay().OrderByDescending(x => x.Datepacked).ToList();

            List <String>   lsDistinctNames = _lsShipmetCount.Select(x => x.UserName).Distinct().ToList();
            List <DateTime> lsDistinctDates = _lsShipmetCount.Select(x => x.Datepacked).Distinct().ToList();

            String[] strCatagories = new string[lsDistinctDates.Count];
            Series[] Seri          = new Series[lsDistinctNames.Count()];

            int si = 0;

            object[] lobj = new object[lsDistinctDates.Count];

            foreach (String Namei in lsDistinctNames)
            {
                List <Object> lso = new List <object>();

                foreach (DateTime Dt in lsDistinctDates)
                {
                    cstUserShipmentCount Shipc = new cstUserShipmentCount();
                    Shipc = _lsShipmetCount.SingleOrDefault(i => i.UserName == Namei && i.Datepacked == Dt);
                    if (Shipc == null)
                    {
                        lso.Add(0);
                    }
                    else
                    {
                        lso.Add(Shipc.ShipmentCount);
                    }
                }
                lso.CopyTo(lobj);

                Series Seris = new Series {
                    Name = Namei, Data = new Data(lobj.ToArray())
                };
                Seri[si] = Seris;
                si++;
            }

            for (int i = 0; i < lsDistinctDates.Count; i++)
            {
                strCatagories[i] = lsDistinctDates[i].ToString("MMM dd, yyyy");
            }

            DotNet.Highcharts.Highcharts Chart = new DotNet.Highcharts.Highcharts("Chart")
                                                 .InitChart(new Chart
            {
                Type = ChartTypes.Line,
            })
                                                 .SetTitle(new Title
            {
                Text = "Shipment Packing Count"
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = (strCatagories),
                Title      = new XAxisTitle {
                    Text = "Packing Dates"
                }
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Shipments packed"
                }
            })
                                                 .SetSeries(Seri);


            ltrTodayspacking.Text = Chart.ToHtmlString();
        }
Exemplo n.º 23
0
        private void plotConsolidatedData()
        {
            //All data graph
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart").InitChart(new Chart
            {
                ZoomType = DotNet.Highcharts.Enums.ZoomTypes.X,
            })
                                                 .SetXAxis(new[] {
                new XAxis
                {
                    Id         = "Month Axes",
                    Categories = datesList,
                    Labels     = new XAxisLabels {
                        Step = 15, StaggerLines = 1
                    }
                    // MinRange=30*24
                }
                //, new XAxis
                //            {
                //                Id="RAM_X",
                //                Type=DotNet.Highcharts.Enums.AxisTypes.Datetime,
                //            // Max=350
                //            }
            });

            chart.SetTitle(new Title {
                Text = "Space Weather and Altitude"
            });
            chart.SetSeries(new[]
                            { new Series
                              {
                                  YAxis = "Sunspot",
                                  XAxis = "Month Axes",
                                  Name  = "Smoothed SSN",
                                  Data  = new Data(smoothedSSNList)
                                          // PlotOptionsLine=new PlotOptionsLine{PointInterval=24*24*3600000, PointStart=new PointStart(Convert.ToDateTime(datesList[0]))}
                              },
//                            new Series
//                            {
//                                Name="CPD",
//                                Data = new Data(cpd2),
//                                Color= System.Drawing.Color.Red,
//                                Type=DotNet.Highcharts.Enums.ChartTypes.Columnrange,
//                                XAxis="RAM_X",
//                                YAxis="RAM_Y",
//                                PlotOptionsColumnrange=new PlotOptionsColumnrange{
//                                Tooltip=new PlotOptionsColumnrangeTooltip{
//                                    PointFormat = "{point.low:%e %b, %y} - {point.high:%e %b, %y}",
//                HeaderFormat = "<b>{series.name}:</b>{point.y}<br />"
//}
//                                }
                              //                {PointFormat = "{point.low:%e %b, %y} - {point.high:%e %b, %y}",
                              //HeaderFormat = "<b>{series.name}:</b>{point.x}<br />"})
                              //  },
                              new Series
                              {
                                  XAxis = "Month Axes",
                                  YAxis = "Altitude",
                                  Name  = "Altitude",
                                  Data  = new Data(altitudeList)
                              },
                              new Series
                              {
                                  XAxis = "Month Axes",
                                  YAxis = "Sunspot",
                                  Name  = "Monthly SSN",
                                  Data  = new Data(monthlySSNList)
                              },
                              new Series
                              {
                                  XAxis = "Month Axes",
                                  YAxis = "Altitude",
                                  Name  = "Average Dose Values",
                                  Data  = new Data(avgDoseInAllDataList)
                              } });
            chart.SetYAxis(new[] {
                new YAxis
                {
                    Id           = "Sunspot",
                    Min          = 0,
                    Max          = 400,
                    TickInterval = 25,
                    Title        = new YAxisTitle {
                        Text = "Sunspot Number"
                    }
                },
                new YAxis
                {
                    Id           = "Altitude",
                    Min          = 0,
                    Max          = 500,
                    TickInterval = 30,
                    Opposite     = true,
                    Title        = new YAxisTitle {
                        Text = "Altitude [km] and dose values [µGy]"
                    }
                },
                //         new YAxis{
                // Type=DotNet.Highcharts.Enums.AxisTypes.Linear,
                // Id="RAM_Y",

                //}
            });
            ltrChart.Text = chart.ToHtmlString();
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /* get data
             */
            DataTable dt = PostOrmDB.GetTop10MentionKeyword();

            var query = dt.AsEnumerable()
                        .GroupBy(row => new
            {
                Text    = row.Field <string>("keyword_value"),
                Keyword = row.Field <int>("KeywordId"),
                Senti   = row.Field <int>("SentiLabel")
            })
                        .Select(grp => new
            {
                Text    = grp.Key.Text,
                Keyword = grp.Key.Keyword,
                Senti   = grp.Key.Senti,
                Count   = grp.Count()
            });

            List <string> ltext    = new List <string>();
            List <string> lkeyword = new List <string>();
            List <int>    lpos     = new List <int>();
            List <int>    lnor     = new List <int>();
            List <int>    lneg     = new List <int>();

            /*
             * get value of pos/nor/neg
             */
            /*
             * foreach (var senti in query)
             * {
             *      if (!lkeyword.Contains(senti.Keyword.ToString()))
             *      {
             *          lkeyword.Add(senti.Keyword.ToString());
             *
             *          if (senti.Senti == 0 || senti.Senti == 1)
             *          {
             *              lneg.Add(senti.Count);
             *          }
             *          else{
             *              lneg.Add(0);
             *          }
             *          if (senti.Senti == 2)
             *          {
             *              lnor.Add(senti.Count);
             *          }
             *          else{
             *              lnor.Add(0);
             *          }
             *
             *          if (senti.Senti == 3 || senti.Senti == 4)
             *          {
             *              lpos.Add(senti.Count);
             *          }
             *          else
             *          {
             *              lpos.Add(0);
             *          }
             *
             *      }
             *      else
             *      {
             *          if (senti.Senti == 0 || senti.Senti == 1)
             *          {
             *              lneg[lneg.Count-1]=senti.Count;
             *          }
             *
             *          if (senti.Senti == 2)
             *          {
             *              lnor[lnor.Count - 1] = senti.Count;
             *          }
             *
             *          if (senti.Senti == 3 || senti.Senti == 4)
             *          {
             *              lpos[lpos.Count - 1] = senti.Count;
             *          }
             *
             *      }
             *
             * }
             * */

            foreach (var senti in query)
            {
                if (!ltext.Contains(senti.Text))
                {
                    ltext.Add(senti.Text);

                    if (senti.Senti == 0 || senti.Senti == 1)
                    {
                        lneg.Add(senti.Count);
                    }
                    else
                    {
                        lneg.Add(0);
                    }
                    if (senti.Senti == 2)
                    {
                        lnor.Add(senti.Count);
                    }
                    else
                    {
                        lnor.Add(0);
                    }

                    if (senti.Senti == 3 || senti.Senti == 4)
                    {
                        lpos.Add(senti.Count);
                    }
                    else
                    {
                        lpos.Add(0);
                    }
                }
                else
                {
                    if (senti.Senti == 0 || senti.Senti == 1)
                    {
                        lneg[lneg.Count - 1] = senti.Count;
                    }

                    if (senti.Senti == 2)
                    {
                        lnor[lnor.Count - 1] = senti.Count;
                    }

                    if (senti.Senti == 3 || senti.Senti == 4)
                    {
                        lpos[lpos.Count - 1] = senti.Count;
                    }
                }
            }

            List <string> lstr = new List <string>();

            /*
             * foreach (var item in lkeyword)
             * {
             *  lstr.Add(item.ToString());
             * }
             */
            foreach (var item in ltext)
            {
                lstr.Add(item);
            }

            //string[] o_keyword = lstr.ToArray();
            string[] o_text = lstr.ToArray();
            object[] o_neg  = lneg.Cast <object>().ToArray();
            object[] o_nor  = lnor.Cast <object>().ToArray();
            object[] o_pos  = lpos.Cast <object>().ToArray();


            /* Display chart
             *
             */
            DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
                                                 .InitChart(new Chart {
                DefaultSeriesType = DotNet.Highcharts.Enums.ChartTypes.Bar
            })
                                                 .SetTitle(new Title {
                Text = "Distribution of Top 10 Keywords In A Week"
            })
                                                 //.SetXAxis(new XAxis { Categories = o_keyword })
                                                 .SetXAxis(new XAxis {
                Categories = o_text
            })
                                                 .SetPlotOptions(new PlotOptions {
                Column = new PlotOptionsColumn {
                    Stacking = Stackings.Normal
                }
            })
                                                 .SetSeries(new[]
            {
                new Series {
                    Name = "Negative", Data = new Data(o_neg)
                },
                new Series {
                    Name = "Normal", Data = new Data(o_nor)
                },
                new Series {
                    Name = "Positive", Data = new Data(o_pos)
                }
            });

            huyChart.Text = chart.ToHtmlString();
        }