Pour faciliter la génération de fonctions de graphique à tarte 3D, j'ai collecté le code de la fonction pour générer des graphiques PIE 3D sous ASP, ce qui est pratique pour tout le monde dans des circonstances particulières.
<%
'Signification des paramètres (tableau, coordonnées horizontales, coordonnées verticales, largeur du graphique, hauteur du graphique, titre du graphique, unité)
FunctionTable2 (stat_array, table_left, table_top, all_width, all_height, table_title, unité)
dimbg_color (10), tarte (10)
bg_color (1) = "# ff1919"
bg_color (2) = "# ffff19"
bg_color (3) = "# 1919ff"
bg_color (4) = "# 19ff19"
bg_color (5) = "# fc0"
bg_color (6) = "# 3cc"
bg_color (7) = "# ff19ff"
bg_color (8) = "# 993300"
bg_color (9) = "# f60"
bg_color (10) = "# ff8c19"
num = ubund (stat_array, 1)
allvalues = 0
fori = 1Tonum
AllValues = AllValues + Stat_Array (I, 1)
suivant
k = 0
fori = 1Tonum-1
PIE (i) = formatNumber (stat_array (i, 1) / allvalues, 4, -1)
k = k + tarte (i)
suivant
tarte (num) = formatNumber ((1-k), 4, -1)
Response.Write "<V: ShapetypeID = 'CALP_3D'COORDSIZE =' 21600,21600'O: SPT = '95'ADJ =' 11796480,5400'PATH = 'AL10800,10800 @ 0 @ 0 @ 2 @ 14.10800,10800,10800,10800 @ 3 @ 15xe'> </ V:"
Response.Write "<V: ShapetypeID = '3DTXT'COORDSIZE =' 21600,21600'O: SPT = '136'ADJ =' 10800'PATH = 'M @ 7, L @ 8, M @ 5,21600L @ 621600E'>"
Response.Write "<V: PathTextPathok = 'T'O: ConnectType =' Custom'o: ConnectLocs = '@ 9,0; @ 10.10800; @ 11,21600; @ 12,10800'o: Connectangles =' 270,180,90,0 '/>"
réponse.write "<v: textPathon = 't'fitshape =' t '/>"
réponse.write "<o: lockv: ext = 'edit'Text =' t'shapetype = 't' />"
Response.Write "</ V: Shapetype>"
Response.write "<v: rectid = 'background'style =' position: absolu; gauche:" & table_left & "px; top:" & table_top & "px; width:" & all_width & "px; height:" & all_height & "px; 'fillcolor =' # efef'strokecolor = 'gray'>"
réponse.write "<v: shadowon = 't'type =' single'color = 'silver'offset =' 4pt, 4pt '/>"
réponse.write "</v: rect>"
Response.Write "<v: groupeid = 'table'style =' position: Absolute; Left:" & table_left & "px; top:" & table_top & "px; width:" & all_width & "px; height:" & all_height & "px; 'coordsize =' 21000,11500 '>"
Response.Write "<v: rectStyle = 'position: relative; gauche: 500; top: 200; largeur: 20000; hauteur: 800'fild =' false'stroked = 'false'>"
réponse.write "<v: textboxinset = '0pt, 0pt, 0pt, 0pt'>"
réponse.write "<tablewidth = '100%' border = '0'align =' Center'CellSpacing = '0'>"
réponse.WRITE "<TR>"
Response.Write "<tdalign = 'Center'valign =' Middle '> <divStyle =' font-size: 15pt; font-family: bold; '> <b>" & table_title & "</b> </div> </td>"
réponse.write "</tr>"
réponse.WRITE "</ Table>"
Response.Write "</ V: TextBox>"
réponse.write "</v: rect>"
réponse.write "<v: rectid = 'back'style =' position: relative; gauche: 500; top: 1000; width: 20000; height: 10000; 'onMouseover =' movereset (1) 'onMouseout =' movereset (0) 'fillcolor =' # 9cf'strokecolor = '# 888888'>"
réponse.write "<v: fillrotate = 't'angle =' - 45'focus = '100%' type = 'gradient' />"
réponse.write "</v: rect>"
Response.write "<v: rectid = 'back'style =' position: relative; gauche: 15000; top: 1400; largeur: 5000; hauteur:" & (num + 1) * 9000/11 + 200) & "; 'fillcolor =' # 9cf'stroked = 't'strokeColor =' # 0099ff '>"
réponse.write "<v: fillrotate = 't'angle =' - 175'focus = '100%' type = 'gradient' />"
réponse.write "<v: shadowon = 't'type =' single'color = 'silver'offset =' 3pt, 3pt '/>"
réponse.write "</v: rect>"
Response.Write "<v: rectStyle = 'position: relative; gauche: 15500; top: 1500; width: 4000; height: 700'fillColor =' # 000000'stroked = 'f'strokeColor =' # 000000 '>"
Response.Write "<v: TextBoxSet = '8pt, 4pt, 3pt, 3pt'style =' font-size: 11pt; '> <divalign =' Left '> <fontcolor =' # ffffff '> <b> total:" & allvalues & unit & unit & "</b> </font> </v> </v: textbox>"
réponse.write "</v: rect>"
fori = 1Tonum
Response.write "<v: rectid = 'rec" & i & "' style = 'position: relatif; gauche: 15400; top:" & i * 9000/11 + 1450 & "; width: 4300; height: 800; affichage: nue'fillcolor =' # efef'strokecolor = '" & bg_color (i) & "' '>"
Response.Write "<V: FillOpacity = '. 6'Color2 =' FillDarken (118) 'O: Opacity2 ='. 6'ROTate = 't'Method =' linearsigma'focus = '100%' type = 'Gradient' />"
réponse.write "</v: rect>"
Response.Write "<v: rectStyle = 'position: relative; gauche: 15500; en haut:" & i * 9000/11 + 1500 & "; largeur: 600; hauteur: 700'fillColor ='" & bg_color (i) & "'stroked =' f '/>" "/>"
Response.Write "<v: rectStyle = 'position: relative; gauche: 16300; en haut:" & i * 9000/11 + 1500 & "; largeur: 3400; hauteur: 700'fild =' f'stroked = 'f'>"
Response.Write "<V: TextBoxSet = '0pt, 5pt, 0pt, 0pt'style =' font-size: 9pt; '> <divalign =' Left '>" & stat_array (i, 2) & ":" & stat_array (i, 1) & unit & "</v> </v: TextBox>"
réponse.write "</v: rect>"
suivant
réponse.write "</v: groupe>"
k1 = 180
k4 = 10
fori = 1Tonum
réponse.write "<ahref = aaa.asp>"
k2 = 360 * tarte (i) / 2
k3 = k1 + k2
ifk3> = 360Then
K3 = K3-360
endire
kkk = (- 11796480 * tarte (i) +5898240)
K5 = 3.1414926 * 2 * (180- (K3-180)) / 360
R = all_height / 2
txt_x = table_left + all_height / 8-30 + r + r * sin (k5) * 0,7
txt_y = table_top + all_height / 14-39 + r + r * cos (k5) * 0,7 * 0,5
titlestr = "Name:" & stat_array (i, 2) & "valeur:" & stat_array (i, 1) & unit & "pourcentage:" & Pie (i) * 100 & "%"
Response.Write "<divStyle = 'Cursor: Hand;'>"
Response.Write "<v: ShapeId = 'Cake" & i & "' Type = '# CACL_3D'TITLE ='" & Titlestr & "'"
Response.Write "Style = 'Position: Absolute; Left:" & table_left + all_height / 8 & "px; top:" & table_top + all_height / 14 & "px; width:" & all_height & "px; height:" & all_height & "px; rotation:" & k3 & "; z-index:" & k4 "' '" "
Response.write "adj = '" & kkk & ", 0'fillColor ='" & bg_color (i) & "'onMouseOver =' movup (gâteau" & i & "," & (table_top + all_height / 14) & ", txt" & i & ", rec" & i & ") '; onMouseOut =' Moulewown (gâteau" & i & "," & (table_top + all_height / 14) & ", txt" & i & ", rec" & i & "); '>"
Response.write "<v: fillopacity = '60293f'color2 =' filllighten (120) 'o: opacity2 =' 60293f'rotate = 't'angle =' - 135'method = 'linearsigma'focus =' 100% 'type =' gradient '/>"
Response.Write "<O: Extrusionv: ext = 'View'on =' T'BackDepth = '25'RotationAngle =' 60'ViewPoint = '0,0'ViewPointorigin =' 0,0'sKewamt = '0'lightPosition =' - 50000, -50000 'LightPosition2 =' 50000 '/>"
Response.Write "</ V: Shape>"
Response.write "<v: shapeId = 'txt" & i & "' type = '# 3dtxt'style =' position: Absolute; Left:" & txt_x & "px; top:" & txt_y & "px; z-index: 20; affichage: non; width: 50; hauteur: 18; 'fillcolor =' # fffff '"
Response.Write "OnMouseOver = 'Ontxt (Cake" & I & "," & (Table_Top + All_Height / 14) & ", txt" & i & ", rec" & i & ")'>"
Response.Write "<V: FillOpacity = '60293f'Color2 =' Fillighten (120) 'O: Opacity2 =' 60293f'rotate = 't'angle =' - 135'Method = 'linearsigma'focus =' 100% 'type =' gradient '/>"
Response.Write "<V: TextPathStyle = 'Font-Family:' 安 '; v-text-kern: t'trim =' t'fitpath = 't'string ='" & Pie (i) * 100 & "% '/>"
réponse.write "<o: extrusionv: ext = 'View'BackDepth =' 8pt'on = 't'lightPosition =' 0,0'lightPosition2 = '0,0' />"
Response.Write "</ V: Shape>"
réponse.write "</div>"
k1 = k1 + k2 * 2
ifk1> = 360Then
K1 = K1-360
endire
IFK1> 180TEN
k4 = k4 + 1
autre
k4 = k4-1
endire
réponse.write "</a>"
suivant
finition de fin
%>
<htmlxmlns: v = "urn: schémas-microsoft-com: vml" xmlns: o = "urn: schémas-microsoft-com: bureau: bureau">
<adal>
<Title> </Title>
<Style>
v /: * {comportement: url (# par défaut # vml)}
o /: * {comportement: url (# par défaut # vml)}
</ Style>
</ head>
<body>
<criptLanguage = "JavaScript">
<! -
ONIT = VRAI
num = 0
functionMoveUp (iteam, top, txt, rec) {
temp = eval (iteam)
tempat = ovale (haut)
Temptxt = eval (txt)
Temprec = eval (rec)
at = paSeInt (temp.style.top)
temprc.style.display = "";
if (num> 27) {
Temptxt.style.display = "";
}