Per i grafici servirebbe una bella classe ma finora nessuna l'ha postata / realizzata. A titolo di esempio ho scritto del codice per creare un'istogramma a tre barre verticali che ti allego il codice.
L'evento click del bottone che traccia il grafico:
PUBLIC SUB Button1_Click()
value = NEW Float[]
total = 3
value.Resize(total + 1)
value[1] = Val(textbox1.Text)
value[2] = Val(textbox2.Text)
value[3] = Val(textbox3.Text)
TracciaGrafico
END
e la routine TracciaGrafico:
PUBLIC SUB TracciaGrafico()
DIM i AS Integer
DIM skala_1 AS Integer
DIM skala_2 AS Integer
DIM distance_x AS Float
DIM distance_y AS Float
DIM width_draw AS Integer
DIM tot AS Integer
DIM colors AS Integer[]
DIM bottom AS Integer
DIM sumdata AS Integer
colors = NEW Integer[]
colors.Resize(total + 1)
FOR i = 1 TO total
sumdata = sumdata + value[i]
NEXT
IF sumdata = 0 THEN sumdata = 1
FOR i = 1 TO total
value[i] = (value[i] / sumdata) * 10
NEXT
drwchart.Clear
draw.Begin(drwchart)
skala_1 = drwchart.ClientH / 11
distance_y = drwchart.ClientH - skala_1
bottom = distance_y + 8
FOR i = 0 TO 100 STEP 10
draw.ForeColor = Color.Black
draw.Text(i, 2, distance_y)
draw.Line(25, distance_y + 8, drwchart.clientw, distance_y + 8)
distance_y = distance_y - skala_1
NEXT
draw.Line(30, 0, 30, drwchart.ClientH)
skala_2 = (drwchart.ClientW - 30) \ 3
distance_x = skala_2 + 30
width_draw = skala_2 / 2
FOR i = 1 TO Total
draw.LineWidth = 1
draw.ForeColor = Color.Black
'draw.Text(i, distance_x - (width_draw / 2) - 4, drwchart.ClientH - 20)
IF i = 1 THEN draw.Text("P", distance_x - (width_draw / 2) - 4, 2)
IF i = 2 THEN draw.Text("G", distance_x - (width_draw / 2) - 4, 2)
IF i = 3 THEN draw.Text("C", distance_x - (width_draw / 2) - 4, 2)
draw.Line(distance_x - (width_draw / 2), 0, distance_x - (width_draw / 2), drwchart.ClientH - skala_1 + 8)
draw.LineWidth = width_draw
draw.ForeColor = color.RGB(i * 100, i * 10, i * 50)
colors[i] = draw.ForeColor
tot = skala_1 * value[i] + skala_1 - 8
draw.Line(distance_x - (width_draw / 2), bottom, distance_x - (width_draw / 2), drwchart.ClientH - tot)
distance_x = distance_x + skala_2
NEXT
DRAW.End
END
SHELL "du -ksh " & user.home & " | cut -f1" TO sShellOutput
Non va mi da questo problemuccio...
Cioè: 9,9G accompagnato da un simbolo strano....
se volessi solo 9,9?