الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

رسم بيانى لنظام تصويت

بدأه java for ever في 16 نوفمبر 2008 · 5 رد · 852 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

انا بعمل نظام تصويت

وعايز اعمل شكل توضيحى زى مستطيل ملون يوضح النسبة المئويه

فكيف يمكننى عمل ذلك

شكرا

#2

فكرة جدا رائعة

يا ليت بقية الاعضاء يفيدونا في هذي الفكرة

وجزاكم الله خير

#3

ممكن تستخدم Div tags لعمل ذلك كما هو موضح في المشاركة رقم 6 في الموضوع التالي

/index.php?showtopic=167446

او شوف الادوات دي

A Look at WebCharts, a Free .NET Charting Control

Free Chart control for ASP.NET.

علي فكرة الموضوع مكرر, استخدم البحث فيما بعد

تم تعديل هذه المشاركة بواسطة AhmedElbaz في 17 نوفمبر 2008 في 10:19

#4

بســم الله الـرحمــن الرحيــم

الحل جدا بسيط ان شاء الله

اولا قم بانشاء مستطيل صغير باي برنامج رسم فوتوشوب او غيره

ثانيا : بعد ان قمت بتصميمه اجعل عرض الصورة 0px واحدبيكسل فقط

ثالثا(الخطوة الاهم)

عندما يتم التصويت على احد محتويات الموضوع فسوف تظهر النتائج اليس كذلك

خذ قيمة كل موضوع واسندها الى خاصية عرض الصورة كما في الاسفل

ImageName.Width=Unit.Pixel(Your Value)

لكي تتضح الصورة اكثر

لنفترض ان لديك تصويت عبارة عن " مارايك في منتديات الفريق العربي للبرمجة "

1-ممتاز 59%

2-جيد جدا 41%

3-مقبول 0%

كما ترى من المثال ناخذ كل قيمة ونضعها في الكود السابق الذي يقوم بوضع قيمة عرض الصورة عن طريق استخدام Unit.Pixel

اتمنى ان يكون الشرح واضحا باذن الله

وفق الله الجميع لما يحب ويرضى

#5

يمكن عمل ذلك بدون صور

بعمل جدول مكون من صف واحد و2 عمود ، والتحكم بعرض كل عمود من خلال القيمة width ، الاول له خلفية ملونه ويمثل النسبة.

<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td width="12%" align="center" bgcolor="#000080"><font color="#FFFFFF">11.94 %</font></td><td width="88%"> </td></tr></table>

post-169219-1226926980_thumb.jpg

الكود بـ #C

  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. Response.Write(Indicator(20, 100));
  4. Response.Write(Indicator(3, 7));
  5. Response.Write(Indicator(24, 201));
  6. Response.Write(Indicator(845, 3654));
  7. }
  8.  
  9. protected string Indicator(int score, int total)
  10. {
  11. double percent;
  12. double ipercent;
  13. string sInd;
  14.  
  15. percent = Math.Round((double)(score * 100) / total, 2);
  16. ipercent = Math.Round(percent);
  17. sInd = "";
  18.  
  19. sInd += "<table border=0 width=100%><tr><td nowrap width=15%><code>" + score.ToString() + "/" + total.ToString() + "</code></td></td><td nowrap width=85%>";
  20. sInd += "<table border=0 width=100% cellspacing=0 cellpadding=0><tr>";
  21.  
  22. sInd += "<td width=" + ipercent.ToString() + "% align=center bgcolor=#000080><font color=#FFFFFF>" + percent.ToString() + " %</font></td>";
  23. sInd += "<td width=" + (100 - ipercent).ToString() + "%> </td>";
  24.  
  25. sInd += "</tr></table>";
  26. sInd += "</td></tr></table>";
  27.  
  28. return sInd;
  29. }
  30.  

الكود بـ VB

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load		Response.Write(Indicator(20, 100))		Response.Write(Indicator(3, 7))		Response.Write(Indicator(24, 201))		Response.Write(Indicator(845, 3654))	End Sub
	Protected Function Indicator(ByVal score As Integer, ByVal total As Integer) As String		Dim percent As Double		Dim ipercent As Double		Dim sInd As String
		percent = Math.Round((score * 100) / total, 2)		ipercent = Math.Round(percent)		sInd = ""
		sInd = sInd + "<table border=0 width=100%><tr><td nowrap width=15%><code>" + score.ToString() + "/" + total.ToString() + "</code></td></td><td nowrap width=85%>"		sInd = sInd + "<table border=0 width=100% cellspacing=0 cellpadding=0><tr>"
		sInd = sInd + "<td width=" + ipercent.ToString() + "% align=center bgcolor=#000080><font color=#FFFFFF>" + percent.ToString() + " %</font></td>"		sInd = sInd + "<td width=" + (100 - ipercent).ToString() + "%> </td>"
		sInd = sInd + "</tr></table>"		sInd = sInd + "</td></tr></table>"
		Indicator = sInd	End Function

او

من خلال جدول مكون من صف واحد و 100 عمود ، بأعتبار أن كل عمود يمثل 1%

او 50 عمود ، بأعتبار أن كل عمود يمثل 2% ... او 25 عمود ، بأعتبار أن كل عمود يمثل 4%

post-169219-1226916680_thumb.jpg

الكود بـ #C

  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. Response.Write(Indicator(20, 100));
  4. Response.Write(Indicator(3, 7));
  5. Response.Write(Indicator(24, 201));
  6. Response.Write(Indicator(845, 3654));
  7. }
  8.  
  9. protected string Indicator(int score, int total)
  10. {
  11. int td;
  12. double percent;
  13. double ipercent;
  14. string sInd;
  15.  
  16. percent = Math.Round((double)(score * 100) / total, 2);
  17. ipercent = Math.Round(percent);
  18. sInd = "";
  19.  
  20. sInd += "<table border=0 width=100%><tr><td nowrap width=15%><code>" + score.ToString()
    + "/" + total.ToString() + "</code></td><td nowrap width=10%><code> = " + percent.ToString() +
    " %</code></td><td nowrap width=75%>";
  21. sInd += "<table border=0 width=100% cellspacing=0 cellpadding=0><tr>";
  22.  
  23. for (td = 0; td < ipercent; td++)
  24. sInd += "<td bgcolor=#000080> </td>";
  25. for (; td < 100; td++)
  26. sInd += "<td> </td>";
  27.  
  28. sInd += "</tr></table>";
  29. sInd += "</td></tr></table>";
  30.  
  31. return sInd;
  32. }
  33.  
  34.  

الكود بـ VB

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		Response.Write(Indicator(20, 100))
		Response.Write(Indicator(3, 7))
		Response.Write(Indicator(24, 201))
		Response.Write(Indicator(845, 3654))
	End Sub

	Protected Function Indicator(ByVal score As Integer, ByVal total As Integer) As String
		Dim td As Integer
		Dim percent As Double
		Dim ipercent As Double
		Dim sInd As String

		percent = Math.Round((score * 100) / total, 2)
		ipercent = Math.Round(percent)
		sInd = ""

		sInd = sInd + "<table border=0 width=100%><tr><td nowrap width=15%><code>" + score.ToString() + "/" + total.ToString() + "</code></td><td nowrap width=10%><code> = " + percent.ToString() + " %</code></td><td nowrap width=75%>"
		sInd = sInd + "<table border=0 width=100% cellspacing=0 cellpadding=0><tr>"

		For td = 1 To ipercent
			sInd = sInd + "<td bgcolor=#000080> </td>"
		Next
		For td = td To 100
			sInd = sInd + "<td> </td>"
		Next

		sInd = sInd + "</tr></table>"
		sInd = sInd + "</td></tr></table>"

		Indicator = sInd
	End Function

تم تعديل هذه المشاركة بواسطة دحدوح في 17 نوفمبر 2008 في 16:11

#6

مشكووووووووووووور يا اخي الكريم وبارك الله فيك

وزادك من علمه سبحانه

مواضيع مشابهة