Create manual Bar chart in HTML from Window Application


User can create Bar-Chart in Html without using HTML tools.

Developer can create HTML Page as a Report in bar Chart from Window Application.
THis will help to create a report sheet in bar chart as a HTML Page.



// for Chart generator
public string ChartDisplayCompMonthlySales(string[,] Data, int counter, string Charttype, string querytype)
{
if (Data == null) throw new ArgumentNullException("Data");
double max1 = 0, mx1;
int v1;
int[] value = new int[counter];

for (int cn = 0; cn < counter; cn++) // Find Maximum
{
if (max1 < Convert.ToDouble(Data[cn, 2]))
max1 = Convert.ToDouble(Data[cn, 2]);
}
if (max1 >= 100000)
{
mx1 = (max1 / 10000);
mx1 = mx1 + 1;
mx1 = mx1 * 10000;
}
else
{
if (max1 >= 10000)
{
mx1 = (max1 / 1000);
mx1 = mx1 + 1;
mx1 = mx1 * 1000;
}
else
{
if (max1 >= 1000)
{
mx1 = (max1 / 100);
mx1 = mx1 + 1;
mx1 = mx1 * 100;
}
else
{
if (max1 >= 100)
{
mx1 = (max1 / 10);
mx1 = mx1 + 1;
mx1 = mx1 * 10;
}
else
{
if (max1 >= 10)
{
mx1 = (max1 / 1);
mx1 = mx1 + 1;
mx1 = mx1 * 1;
}
else
mx1 = 10;
}
}
}
}

int mx2 = (int)Math.Round(Convert.ToDouble(mx1 / 6));

for (int cn1 = 0; cn1 < counter; cn1++)
{
value[cn1] = ((Convert.ToInt32(Data[cn1, 2]) * 600) / (int)Math.Round(mx1));
}

//htmlstring11 += "
" + i * mx2 + "
";

int temp = 0;
int flag11 = 1;
string htmlstrg = "
Sales Vs Monthly Yearly Comparison
";
htmlstrg += "
";

bookname1:

if (Charttype == "book")
{
if (querytype == "compbook")
htmlstrg += "";
else if (querytype == "comptaluka")
htmlstrg += "";
else if (querytype == "compdistrict")
htmlstrg += "";
else if (querytype == "compstate")
htmlstrg += "";
else if (querytype == "compcustomer")
htmlstrg += "";
}
else
htmlstrg += "";

htmlstrg += "";

if (temp < counter)
goto bookname1;
}
}
}
htmlstrg += "
" + Data[temp, 0] + "
" + Data[temp, 0] + "
" + Data[temp, 0] + "
" + Data[temp, 0] + "
" + Data[temp, 0] + "
" + month_list[Convert.ToInt32(Data[temp, 0]) - 1] + "
";
htmlstrg += ""; //border=1 bordercolor=yellow

string colorname = objrandom.Next(10).ToString() + objrandom.Next(10).ToString() + objrandom.Next(10).ToString() +
objrandom.Next(10).ToString() + objrandom.Next(10).ToString() + objrandom.Next(10).ToString();

for (v1 = temp; v1 <= counter; v1++)
{
temp++;
if (temp <= counter)
{

htmlstrg += "";//#8B9BBA


if (Data[v1, 0] != Data[temp, 0])
{
htmlstrg += "
" + Data[v1, 1] + "" + //style=\"layout-flow : vertical-ideographic; \"
"
" + Data[v1, 2] + "
" +
"
";

return htmlstrg; // return Html string

}

/// Create HTML file
public void PRINTHtmlString(string htmlpage)
{
StreamWriter SW = File.CreateText("c:\\visitdetail.htm");
SW.WriteLine(htmlpage);
SW.Close();
webBrowser1.Navigate("c:\\visitdetail.htm");
}


Attachments

  • Manual bar Chart in HTML (35827-7520-Chart-Generator.txt)
  • Comments

    Author: ABitSmart07 Jan 2010 Member Level: Gold   Points : 0

    Please add code under code block.

    Author: ABitSmart07 Jan 2010 Member Level: Gold   Points : 0

    Please add some description.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: