I have a problem with duplicates words in memory game.
I have a code (bellow) and what I want to duplicate labels and pass it (in random position every time when app is open) to bellow row e.g
Open app first time
| label1 | label2 | label3 | <= first row
| label3 | label2 | label1 | <= second row
Open app second time
| label1 | label2 | label3 | <= first row
| label1 | label3 | label2 | <= second row
private void AssingWordsToSquares()
{
Label label;
int randomNumber;
string path = $"{_currentPath}\\Resources\\Words.txt";
_loadWordsList = File.ReadAllLines(path).ToList();
for (int i = 0; i < tableLayoutPanel1.Controls.Count; i++)
{
if (tableLayoutPanel1.Controls[i] is Label)
{
label = (Label)tableLayoutPanel1.Controls[i];
}
else
continue;
randomNumber = random.Next(0, _loadWordsList.Count);
label.Text = _loadWordsList[randomNumber];
_loadWordsList.RemoveAt(randomNumber);
}
``
So, at the moment, the function you shared is doing 2 things.
1 is to find random words from a dictionary in a file
2 is to place the words in a random order on screen
So you have 2 random operations happening. Remember the golden rule which is 1 function should try and do just 1 thing. It should have just 1 purpose.
So, you could seperate out that functionality to make it clearer.
We could start by creating a function that will generate a random list of words from your dictionary file. Something like this:
List<string> GenerateRandomWords(int numWords)
{
var randomWordList = new List<string>();
var wordList = System.IO.File.ReadAllLines("RandomWords.txt").ToList();
for (int nLoopCnt = 0; nLoopCnt < numWords; nLoopCnt++)
{
var randomNumber = random.Next(0, wordList.Count);
randomWordList.Add(wordList[randomNumber]);
}
return randomWordList;
}
Now you have your random words extracted from the file we need to put them on the screen in a random order. So, we could create another function GenerateRandomPosOrder that takes a TableLayoutPanel and generates a list of columns in a random order. So, each time you run this function is could return 1,2,3 or 1,3,2 or 3,2,1.
private HashSet<int> GenerateRandomPosOrder(TableLayoutPanel table)
{
Thread.Sleep(500);
Random rnd = new Random();
var result = new HashSet<int>();
while (result.Count < table.ColumnCount)
{
var randomNumber = rnd.Next(0, table.ColumnCount);
result.Add(randomNumber);
}
return result;
}
Now we can put these 2 functions together in your AssignWordsToSquares like so.
private void AssignWordsToSquares(TableLayoutPanel table)
{
var wordList = GenerateRandomWords(table.ColumnCount);
// loop around every row in the table
for (int rowCount = 0; rowCount < table.RowCount; rowCount++)
{
// this could return 0,2,1 or 1,0,2 or 1,2,0
var order = GenerateRandomPosOrder(table);
int pos = 0;
foreach (var randomPosition in order)
{
var tableCell = (Label)table.GetControlFromPosition(column: randomPosition, row: rowCount);
tableCell.Text = wordList[pos++];
}
}
}
The above function first gets a list of random words from the dictionary, then for ever row of the TableLayoutPanel it puts the words in a random order.
Related
at school i get a task to create a program, which search for strong contiguous components in graph. My program gives correct output, but a program is slow. I cant get into global time requirement. Can somebody help me make a program faster? Thanks you all.
Task:
For a given set of web pages, we want to find largest subsets such that from every page in a subset you can follow links to any other page in the same subset.
Input:
On the first line, there are two numbers, number of the pages N, and total number of links M. Pages are numbered from 0 up to N-1. On lines 2 up to M+1, there are two numbers per line. The first is the source page and the second is the target page of a link.
Output:
On N lines there is a component ID for every single page. The componet ID is the smallest page index on the component.
Time limits:
Amount of data: 10000 -> max 0.2 seconds / Amount of data: 100000 -> max 2 seconds / Amount of data: 500000 -> max 10 seconds
Examples:
Input: Input:
3 3 3 3
0 1 1 2
1 0 2 1
1 2 1 2
Output: Output:
0 0
0 1
2 1
Program:
Program is written in czech language, but i tried description it in english.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tgh_web
{
class Vrchol //class Vertex
{
public int cislo_vrcholu; //page ID (ID of vertex)
public int cislo_komponenty; //component ID where is page
public bool prepsano = false; //A flag that indicates whether the component ID has been overwritten by the smallest page ID on the component
//for graph
public int typ_vrcholu; //vertex mark -> 0 - unvisited (white), 1 - visiting (gray), 2 - visited/locked (black)
public List<int> sousedici_vrcholy; //neighbors of page (vertex), there is link between page (vertex) and neighbor from List
public int pre_time, post_time; //previsit time and postvisit time of vertex time (for DFS)
//for transpose graph
public int typ_vrcholu_trans; //mark of vertex in transpose graph
public List<int> sousedici_vrcholy_trans; //neighbors of vertex in transpose graph
public int pre_time_trans, post_time_trans; //previsit time and postvisit time of vertex in transpose graph (for DFS in transpose graph)
}
class Program
{
public static int time, time_trans;
public static List<Vrchol> seznam_vrcholu; //list of vertices (pages)
public static int komponenta = 0; //component number
public static Stack<Vrchol> zasobnik; //stack
public static List<int> vrcholy_komponenty; //list of vertices in this component
//DFS in graph
public static void DFS(Vrchol vrchol)
{
vrchol.typ_vrcholu = 1; //mark of vertex is set to 1 - visiting
time = time + 1;
vrchol.pre_time = time; //set previsit time of vertex
zasobnik.Push(vrchol);
List<Vrchol> list_sousedici_vrcholy = new List<Vrchol>();
foreach (int index in vrchol.sousedici_vrcholy)
list_sousedici_vrcholy.Add(seznam_vrcholu.Find(x => x.cislo_vrcholu == index));
foreach (Vrchol v in list_sousedici_vrcholy)
if (v.typ_vrcholu == 0)
DFS(v);
vrchol.typ_vrcholu = 2; //mark of vertex is set to 2 - visited/locked
time = time + 1;
vrchol.post_time = time;
zasobnik.Pop();
vrchol.cislo_komponenty = komponenta;
if (zasobnik.Count == 0)
komponenta++;
}
//DFS in transpose graph
public static void DFS_trans(Vrchol vrchol)
{
vrchol.typ_vrcholu_trans = 1;
time_trans = time_trans + 1;
vrchol.pre_time_trans = time_trans;
List<Vrchol> list_sousedici_vrcholy_trans = new List<Vrchol>();
foreach (int index in vrchol.sousedici_vrcholy_trans)
list_sousedici_vrcholy_trans.Add(seznam_vrcholu.ElementAt(index));
foreach (Vrchol v in list_sousedici_vrcholy_trans)
if (v.typ_vrcholu_trans == 0)
DFS_trans(v);
vrchol.typ_vrcholu_trans = 2;
time_trans = time_trans + 1;
vrchol.post_time_trans = time_trans;
}
public static void Main(string[] args)
{
int time, time_trans = 0;
seznam_vrcholu = new List<Vrchol>();
zasobnik = new Stack<Vrchol>();
vrcholy_komponenty = new List<int>();
int pocet_vrcholu, pocet_hran, aktualni_hrana = 0; //number of vertex, number of links, actual_link is set to 0
string prvni_radek, radek; //first row, next rows
string[] casti_prv_radku, casti_radku; //parts of firts row, parts of next rows
int hrana_out, hrana_in; //links
//loading first row - input (first row - number of pages(vertices) + total number of links)
prvni_radek = Console.ReadLine();
casti_prv_radku = prvni_radek.Split(' ');
int.TryParse(casti_prv_radku[0], out pocet_vrcholu);
int.TryParse(casti_prv_radku[1], out pocet_hran);
//creating vertex
for (int i = 0; i < pocet_vrcholu; i++)
{
Vrchol v = new Vrchol();
v.cislo_vrcholu = i; //id of vertex = i
v.typ_vrcholu = 0; //mark of vertex set to 0 - unvisited
v.typ_vrcholu_trans = 0; //mark of vertex in transpose graph set to 0
v.sousedici_vrcholy = new List<int>();
v.sousedici_vrcholy_trans = new List<int>();
seznam_vrcholu.Insert(i, v);
}
//loading next rows - input (on a row is the source page and the target page of a link
while (aktualni_hrana < pocet_hran) //actual_link < total number of links
{
radek = Console.ReadLine();
casti_radku = radek.Split(' ');
int.TryParse(casti_radku[0], out hrana_out);
int.TryParse(casti_radku[1], out hrana_in);
//targed page, where link goes in (hrana_in), add to the list of neighbors (sousedici_vrcholy) that belongs to source page, where link goes out (hrana_out)
seznam_vrcholu.ElementAt(hrana_out).sousedici_vrcholy.Add(hrana_in);
//It is the same, but pages (vertex) are swaped (to create a transpose graph)
seznam_vrcholu.ElementAt(hrana_in).sousedici_vrcholy_trans.Add(hrana_out);
aktualni_hrana++;
}
//DFS in transpose graph
foreach (Vrchol v in seznam_vrcholu)
if (v.typ_vrcholu_trans == 0)
DFS_trans(v);
//top sorting by postvisit time in transpose graph
seznam_vrcholu.Sort(delegate(Vrchol x, Vrchol y)
{
if (x.post_time_trans == null && y.post_time_trans == null) return 0;
else if (x.post_time_trans == null) return -1;
else if (y.post_time_trans == null) return 1;
else return y.post_time_trans.CompareTo(x.post_time_trans);
});
//DFS in graph, where vertices are sorted
foreach(Vrchol v in seznam_vrcholu)
if (v.typ_vrcholu == 0)
DFS(v);
//overwriting component ID
//the componet ID is the smallest page index on the component
for (int i = 0; i < komponenta; i++ )
{
vrcholy_komponenty.Clear();
foreach(Vrchol v in seznam_vrcholu)
if(v.cislo_komponenty == i && v.prepsano == false)
vrcholy_komponenty.Add(v.cislo_vrcholu);
int min = vrcholy_komponenty.ElementAt(0);
foreach(int cislo_vrcholu in vrcholy_komponenty)
if(cislo_vrcholu < min)
min = cislo_vrcholu;
//overwriting component ID and setting overwritten flag (v.prepsano) as true
foreach (Vrchol v in seznam_vrcholu)
if (v.cislo_komponenty == i && v.prepsano == false)
{
v.cislo_komponenty = min;
v.prepsano = true;
}
}
//output
for (int j = 0; j < pocet_vrcholu; j++)
Console.WriteLine(seznam_vrcholu.Find(x => x.cislo_vrcholu == j).cislo_komponenty);
Console.ReadKey();
}
}
}
How can I display a specific set of items in an array?
I want to print 25 items to screen from index 0 to 24 and another 25 starting from index 25, in that order.
I can display all items, but how can I display from a specific index in the array to another specific index?
Example: I have 100 items in my array.
And I want to show from 0 to 3 and from 4 to 7 and so on.
For Example: String of letters: A B C D E F G etc.
And I want to show only A B C. But when I do something it show next 3 in array.
Since im using B_items as object in an array. I wanna show only 0, 1, 2 in array and again form 3, 4, 5 and so on.
public class B_items
{
public string Name {get; set;}
public int Value { Get; set;}
}
B_items[,] items;
public Inventory(Backpack Bpack, int Columns, int Rows, int SlotWidth, int SlothHeight, Vector2 Pos)
{
items = new B_items[Columns, Rows];
pos = Pos;
slotWight = SlotWidth;
slotHeight = SlothHeight;
backpack = Bpack;
this.Columns = Columns;
this.Rows = Rows;
LoadItems(Bpack);
}
for(int i = 0; i < items.Length; i++)
{
Console.WritleLine(Items[i].Name;
}
}
if (items[X, Y] != null)
{
spriteBatch.Draw(items[X, Y].Texure, new Rectangle(DrawX, DrawY, slotWight, slotHeight),new Rectangle(0,0,64,64),Color.White);
if (items[X, Y].StackSize > 1)
{
spriteBatch.DrawString(AssetManager.GetInstance().font["Arial8"], items[X, Y].StackSize.ToString(), new Vector2(DrawX + 24, DrawY + 22), Color.White);
}
}
This will write all and I want to do 5 of those. While I have 100 and each time I press a button it shows next 5 in that list.
How can I show specific list of items...form index 0 to 10 and form 11 to 20 and so on.
var stats = items.Skip(5).Take(5)
I can't do this... I do not see .Take(param) or .Skip(param)
I am using
using System.Linq;
using System;
I'm sorry for not being specific. I can't nor sometimes know how to ask a valid question. My English is not my first language so fix my grammar and delete this line
And I want to show from 0 to 3 and from 4 to 7 and so on.
You can use a normal for-loop and specify the step size that you want to increment. Every step you would skip the items that you have already processed and take each time only the specified step size (in your case 3).
This should do the trick:
// test array
int[] array = Enumerable.Range(1, 100).ToArray();
int stepsize = 3;
for (int i = 0; i < array.Length; i += stepsize)
{
string s = String.Join(" ", array.Skip(i).Take(stepsize));
Console.WriteLine(s);
}
You can use LINQ to access ranges of your array. Skip lets you decide where you start your range and Take how many entries you want.
If you want D E F from your example you can use:
var subRange = items.Skip(3).Take(3);
foreach (string item in subRange) {
Console.WriteLine(item);
}
what I have right now are two listbox which are lstItem and lstQty and I want to save both value into single textfile.
lstItem | lstQty
Chicken | 3
Fish | 2
Lamb | 1
I want this value saved into textfile like this:
Chicken | 3
Fish | 2
Lamb | 1
Instead of:
Chicken
Fish
Lamb
3
2
1
These is my codes:
string receiptFile = #"D:\VisualStudio2012\SalesDetails.txt";
StreamWriter file2 = new StreamWriter(receiptFile, true);
List<string> totalSales = new List<string>();
foreach (object item in lboItem.Items)
{
totalSales.Add(item as string);
file2.WriteLine(item);
}
foreach (object item2 in lboQty.Items)
{
totalSales.Add(item2 as string);
file2.WriteLine(item2);
}
file2.Close();
I know why it shows in textfile like what i mentioned above. It happens because i have no idea how to make it like what i want. Thank you in advance to anyone that can solve this.
Well, instead of your two loops you need only one and during this one loop you just need to concatenate values from both listboxes and write them to file.
Something like this:
int itemsCount = Math.Min(lboItem.Items.Count, lboQty.Items.Count);
for (int i = 0; i < itemsCount; i++)
{
string item = "";
if (i < lboItem.Items.Count)
item = lboItem.Items[i].ToString();
item += " | ";
if (i < lboQty.Items.Count)
item += lboQty.Items[i].ToString();
totalSales.Add(item);
file2.WriteLine(item);
}
I'm not sure why do you need totalSales list here - but it's up to your logic.
Also note - there is check here for the situation when sizes of listboxes are not equal. If your listboxes sizes are guarantied to be equal - this check is redundant you can simplify this code snippet to
int itemsCount = lboItem.Items.Count;
for (int i = 0; i < itemsCount; i++)
{
string item = string.Format("{0} | {1}", lboItem.Items[i], lboQty.Items[i]);
totalSales.Add(item);
file2.WriteLine(item);
}
If both listboxes always have the same number of items, maybe this helps you:
string receiptFile = #"D:\VisualStudio2012\SalesDetails.txt";
StreamWriter file2 = new StreamWriter(receiptFile, true);
for(int i=0; i < lboItem.Items.Count; i++)
{
file2.WriteLine(string.Format("{0} | {1}", lboItem.Items[i].ToString(), lboQty.Items[i].ToString()));
}
file2.Close();
I didn't realize the purpose of totalSales. If you need it, you can add it inside the for loop.
I have 5 random numbers each in separate label and would like to sort them form lowest to highest and place them in new label.
Example:
Labels with random numbers from 1 - 60.
number1.Text = 42
number2.Text = 51
number3.Text = 12
number4.Text = 33
number5.Text = 26
I would like to place that numbers form lowest to highest each in separate label.
Example:
sortNumber1.Text = 12
sortNumber2.Text = 26
sortNumber3.Text = 33
sortNumber4.Text = 42
sortNumber5.Text = 51
So far I try to place all sorted numbers in one label with this code:
private void button63_Click(object sender, EventArgs e)
{
var orderNumber1 = Convert.ToInt32(number1.Text);
var orderNumber2 = Convert.ToInt32(number2.Text);
var orderNumber3 = Convert.ToInt32(number3.Text);
var orderNumber4 = Convert.ToInt32(number4.Text);
var orderNumber5 = Convert.ToInt32(number5.Text);
int[] numbers = { orderNumber1, orderNumber2, orderNumber3, orderNumber4, orderNumber5};
Array.Sort(numbers);
int i = 0;
for (i = 0; i < numbers.Length; i++)
{
selected_number1.Text = (numbers[i].ToString());
}
}
But only last (highest) number was entered. If something doesn't make any sense it's because I am noob. Solution that I will understand would be great. Thank you.
I would change entire design here (create a list of labels and use it to iterate over your labels), but for now you can make it work replacing your for loop with following:
sortNumber1.Text = numbers[0].ToString();
sortNumber2.Text = numbers[1].ToString();
sortNumber3.Text = numbers[2].ToString();
sortNumber4.Text = numbers[3].ToString();
sortNumber5.Text = numbers[4].ToString();
If you want a single string, you need to concatenate them. Probably the easiest way is with LINQ:
var numStrings = numbers.Select((i) => i.ToString());
selected_number1.Text = string.Join(",", numStrings);
for (i = 0; i < numbers.Length; i++)
{
selected_number1.Text = (numbers[i].ToString());
}
In your loop you are setting selected_number1.Text each time so that's the only one getting set.
Try this:
int[] numbers = { orderNumber1, orderNumber2, orderNumber3, orderNumber4, orderNumber5 };
Array.Sort(numbers);
foreach (var item in numbers)
{
Console.WriteLine(item);
}
all though you have already answered....
List<TextBox> tBoxes = new List<TextBox>();
tBoxes.Add(number1);
tBoxes.Add(number2);
tBoxes.Add(number3);
tBoxes.Add(number4);
tBoxes.Add(number5);
List<int> allNums = new List<int>();
foreach (TextBox item in tBoxes)
{
allNums.Add(int.Parse(item.Text));
}
allNums.Sort();
for (int i = 0; i < tBoxes.Count - 1; i++)
{
tBoxes[i].Text = allNums[i].ToString();
}
As you iterate over your sorted array, you repeatedly set the same control to the current value with this statement:
selected_number1.Text = (numbers[i].ToString());
I'd probably do something along these lines:
Label[] display = { Sorted1 , Sorted2 , Sorted3 , Sorted4 , Sorted5 , } ;
Label[] unsorted = { Label1 , Label2 , Label3 , Label4 , Label5 , } ;
int[] sorted = unsorted.Select( x => int.Parse(x.Text) ).OrderBy( x => x ).ToArray() ;
for ( int i = 0 ; i < 5 ; ++i )
{
display[i].Text = sorted[i].ToString() ;
}
I have an asp:Chart control and it is working great. I simply am passing it times (in millitary format) and then values that are average length in time of requests. The following code does what I need - almost (feel free to mark it up if I am going overboard for I am new to the chart control).
My data is in table for like the following:
Date by Hours 9:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00
12/03/2010 8 43 53 55 33 46 51 60 50 9
Friday 1.773 1.337 1.242 1.239 1.340 1.191 1.479 1.223 1.178 1.516
Gives me a nice chart. My question is below this code:
List<double> yValues = new List<double>();
List<string> xValues = new List<string>();
// First and Last columns do not contain chartable data
for (int i = 1; i < dtResults.Columns.Count - 1; i++) {
double d;
if (double.TryParse(dtResults.Rows[1][i].ToString(), out d))
yValues.Add(d == 0 ? double.NaN : d);
else
yValues.Add(double.NaN);
} // foreach of the Average Time Values the chart
// foreach of the column names
for (int i = 1; i < dtResults.Columns.Count - 1; i++)
xValues.Add(dtResults.Columns[i].ColumnName);
this.Chart.Titles["Title1"].Text = string.Format(
"Average Request Time In Seconds On {0:MM/dd/yyyy} Between {1:HH} and {2:HH} In {3}",
this.DateRange.BeginDate.Value,
this.ucsTimePicker.BeginTime,
this.ucsTimePicker.EndTime,
this.SelectedSourceEnvironmentName
);
this.Chart.Series["Series1"].Points.DataBindXY(xValues, yValues);
this.Chart.Series["Series1"].ChartType = SeriesChartType.Line;
this.Chart.Series["Series1"].IsValueShownAsLabel = true;
this.Chart.Series["Series1"]["ShowMarkerLines"] = "true";
this.Chart.Series["Series1"].Label = "#VALY{0.000}"; // Make sure they have only 3 decimal places
this.Chart.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = true;
this.Chart.ChartAreas["ChartArea1"].AxisX.Title = "Hours of the Day";
this.Chart.ChartAreas["ChartArea1"].AxisY.Title = "Time in Seconds";
// Handle styling when there is a Zero or missing value
this.Chart.Series["Series1"].EmptyPointStyle.Color = Color.Red;
this.Chart.Series["Series1"].EmptyPointStyle.BorderWidth = 3;
this.Chart.Series["Series1"].EmptyPointStyle.BorderDashStyle = ChartDashStyle.Dash;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerStyle = MarkerStyle.Diamond;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerColor = Color.Red;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerSize = 8;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerBorderColor = Color.Black;
this.Chart.Series["Series1"]["EmptyPointValue"] = "Zero";
There are labels showing (the decimal numbers in the table above) but what I want to do is have the label Also show the total number of requests which is the 2nd row of data in the table above. I was able to add the values to the chart with the code below:
for (int i = 1; i < dtResults.Columns.Count - 1; i++) {
int n;
if (int.TryParse(dtResults.Rows[0][i].ToString(), out n))
this.Chart.Series["Series1"].Points.AddY(n);
else
this.Chart.Series["Series1"].Points.AddY(0);
} // foreach of the Count of Request within the Hour values
That seemed to not throw any fits, but I couldn't access the values with the following adjustment:
this.Chart.Series["Series1"].Label = "#VALY{0.000}\n#VALY2{0}";
All I get is the original value (1.773) showing up twice.
So is there a way to add data to a Chart that is only for labeling purposes and then access it?
Okay, after no help here (which actually shocks me) I was able to figure it out with some help outside of this site. Essentially, I don't have to Add the "extra" data but I do have to modify each Label as opposed to just having the generic label like the following:
this.Chart.Series["Series1"].Label = "#VALY{0.000}"; // Make sure they have only 3 decimal places
I also had to take out the following line:
this.Chart.Series["Series1"].IsValueShownAsLabel = true;
So just for brevity, here is the entire code giving me the two line label where the first line shows the average (which is the actual chart data) and the second line is the count which is not in the data at all.
List<double> yValues = new List<double>();
List<string> xValues = new List<string>();
List<int> zValues = new List<int>();
// First and Last columns do not contain chartable data
for (int i = 1; i < dtResults.Columns.Count - 1; i++) {
double d;
if (double.TryParse(dtResults.Rows[1][i].ToString(), out d))
yValues.Add(d == 0 ? double.NaN : d);
else
yValues.Add(double.NaN);
} // foreach of the Average Time Values the chart
// foreach of the column names
for (int i = 1; i < dtResults.Columns.Count - 1; i++)
xValues.Add(dtResults.Columns[i].ColumnName);
this.Chart.Titles["Title1"].Text = string.Format(
"Average Request Time In Seconds On {0:MM/dd/yyyy} Between {1:HH} and {2:HH} In {3}",
this.DateRange.BeginDate.Value,
this.ucsTimePicker.BeginTime,
this.ucsTimePicker.EndTime,
this.SelectedSourceEnvironmentName
);
this.Chart.Series["Series1"].Points.DataBindXY(xValues, yValues);
/// This loop will setup the point labels in a two line format where the first line displays
/// the Average that the point is actually showing. The second line is data taken from the
/// results table and is not a part of the chart at all but is useful information and is the
/// Count of records in that time frame.
/// In order for this to work, the Series property IsValueShownAsLabel needs to be NOT True.
for (int i = 0; i < this.Chart.Series["Series1"].Points.Count; i++) {
int n = 0;
int.TryParse(dtResults.Rows[0][i + 1].ToString(), out n);
this.Chart.Series["Series1"].Points[i].Label = string.Format("Avg: #VALY{{0.000}}\nCount: {0}", n);
} // foreach of the Count of Request within the Hour values
this.Chart.Series["Series1"].ChartType = SeriesChartType.Line;
this.Chart.Series["Series1"]["ShowMarkerLines"] = "true";
this.Chart.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = true;
this.Chart.ChartAreas["ChartArea1"].AxisX.Title = "Hours of the Day";
this.Chart.ChartAreas["ChartArea1"].AxisY.Title = "Time in Seconds";
// Handle styling when there is a Zero or missing value
this.Chart.Series["Series1"].EmptyPointStyle.Color = Color.Red;
this.Chart.Series["Series1"].EmptyPointStyle.BorderWidth = 3;
this.Chart.Series["Series1"].EmptyPointStyle.BorderDashStyle = ChartDashStyle.Dash;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerStyle = MarkerStyle.Diamond;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerColor = Color.Red;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerSize = 8;
this.Chart.Series["Series1"].EmptyPointStyle.MarkerBorderColor = Color.Black;
this.Chart.Series["Series1"]["EmptyPointValue"] = "Zero";