Foros del Web » Programando para Internet » ASP Clásico »

graficas con ChartDir-Ampliar espacio entre valores

Estas en el tema de graficas con ChartDir-Ampliar espacio entre valores en el foro de ASP Clásico en Foros del Web. Hola a todos, Estoy haciendo unas graficas en ASP con ChartDir, pero no se como hacer para ampliar los espacios entre los valores en el ...
  #1 (permalink)  
Antiguo 11/11/2009, 17:57
 
Fecha de Ingreso: febrero-2007
Mensajes: 139
Antigüedad: 18 años, 3 meses
Puntos: 0
graficas con ChartDir-Ampliar espacio entre valores

Hola a todos,

Estoy haciendo unas graficas en ASP con ChartDir, pero no se como hacer para ampliar los espacios entre los valores en el ejex, ya que los valores que tengo son sacados de una base de datos y son fechas (las cuales son muy grandes para mostrar y queda todo muy pegado) y tambien como hacer para mostrar solo los datos de la grafica hasta el valor final, es que me muestra ceros despues de que ya no hay valores en la base de datos.
Adjunto codigo.
Código HTML:
<%@ language="vbscript" %>
<!--#include file="Connections/ElabCavas.asp" -->
<%
FechaReport1	= "'" & Replace("2009-11-07", "'", "''") & " " & "00:00" & "'"
FechaReport2	= "'" & Replace("2009-11-11", "'", "''") & " " & "23:59" & "'"

Dim Consulta
Set Consulta= Server.CreateObject("ADODB.Recordset")
Consulta.ActiveConnection = MM_ElabCavas_STRING	
Consulta.Source = "SELECT fecha, extracto,ph, recuento FROM dbo.Propagador WHERE Fecha between  " + FechaReport1 +  "and" + FechaReport2 + " order by fecha "
Consulta.CursorType = 0
Consulta.CursorLocation = 2
Consulta.LockType = 1
Consulta.Open()

Dim data1(20)
Dim data2(20)
Dim data3(20)
Dim fechas(20)
i = 0
final=0
if (Not Consulta.eof) then
	Consulta.movefirst()
	Do while (Not Consulta.eof)
		fechas(i)= hour(Consulta.fields.item("Fecha").value)&":"&minute(Consulta.fields.item("Fecha").value)		
		data1(i)= Consulta.fields.item("extracto").value
		data2(i)= Consulta.fields.item("ph").value
		data3(i)= Consulta.fields.item("recuento").value
		if i= 0 then
			maxvalor = data3(i)
		else	
			if data3(i)>maxvalor then
				maxvalor = data3(i)
			end if	
		end if	
		i=i+1
		Consulta.movenext()
	loop	
end if	
final =i-1

Set cd = CreateObject("ChartDirector.API")

'------Create an XYChart object of size 600 x 300 pixels, with a light blue (EEEEFF)-----
'------background, black border, 1 pxiel 3D border effect and rounded corners-----------
Set c = cd.XYChart(800, 500, &Heeeeff, &H000000, 1)
Call c.setRoundedFrame()

'------Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white background.----
'------Turn on both horizontal and vertical grid lines with light grey color (0xcccccc)-----
Call c.setPlotArea(55, 58, 720, 395, &Hffffff, -1, -1, &Hcccccc, &Hcccccc)

'------Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 9 pts----
'------Arial Bold font. Set the background and border color to Transparent.-----------
Call c.addLegend(50, 30, False, "arialbd.ttf", 9).setBackground(cd.Transparent)

'------Add a title box to the chart using 15 pts Times Bold Italic font, on a light blue---
'------(CCCCFF) background with glass effect. white (0xffffff) on a dark red (0x800000)----
'------background, with a 1 pixel 3D border.---------------------------------------------
Call c.addTitle("PROPAGACION DE LEVADURA", "timesbi.ttf", 15).setBackground(&Hccccff, &H000000, cd.glassEffect())

'-------Add a title to the y axis------------
Call c.yAxis().setTitle("Extracto-Ph-Recuento")

'-------Add a title to the x axis-----------
Call c.xAxis().setTitle("Fechas (h:m)")

'-------Display 1 out of 3 labels on the x-axis.----
Call c.xAxis().setLabelStep(1)

'-------Add a line layer to the chart-----------
Set layer = c.addLineLayer2()

'---------Set the default line width to 2 pixels-------
Call layer.setLineWidth(2)

'---------Set the labels on the x axis by spreading the labels evenly between the first point-----
'---------(index = 0) and the last point (index = noOfPoints - 1)-------------
Call c.yAxis().setLinearScale(0, maxvalor+10,10)

'--------Add the three data sets to the line layer. For demo purpose, we use a dash line-----
'--------color for the last line-----------
'--------Add the first line. Plot the points with a 7 pixel square symbol-----------
' Add the first line. Plot the points with a 7 pixel square symbol
Call layer.addDataSet(data1, &Hcf4040, "Extracto").setDataSymbol(cd.circleSymbol, 7)
Call layer.addDataSet(data2, &H00ff00, "PH").setDataSymbol(cd.DiamondSymbol, 7)
Call layer.addDataSet(data3, &Hff6600, "Recuento (*10^6)").setDataSymbol(cd.Cross2Shape(), 7)

'-------Set the labels on the x axis.--------
Call c.xAxis().setLabels(fechas)

'---------Enable data label on the data points. Set the label format to nn%.----------
Call layer.setDataLabelFormat("{value}")

'---------Output the chart----------
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>
Solo me hace falta esto para tener la grafica lista, asi que al que me pueda ayudar muchas gracias.
  #2 (permalink)  
Antiguo 12/11/2009, 06:52
 
Fecha de Ingreso: febrero-2008
Ubicación: Buenos Aires
Mensajes: 58
Antigüedad: 17 años, 2 meses
Puntos: 0
Respuesta: graficas con ChartDir-Ampliar espacio entre valores

lo que yo hice fue poner en 45 grados los labels del eje x, de esa manera no se te "empasta"..
que te quedan 0(ceros) debe ser porque tenés mas datos en un array que en otro...

Call c.xAxis().setLabels(labels).setFontAngle(-45)

esa sentencia usé para ponerlo en 45 grados. espero te sirva! Ponela debajo de

'-------Set the labels on the x axis.--------
Call c.xAxis().setLabels(fechas)

saludos!
  #3 (permalink)  
Antiguo 12/11/2009, 09:37
 
Fecha de Ingreso: febrero-2007
Mensajes: 139
Antigüedad: 18 años, 3 meses
Puntos: 0
Respuesta: graficas con ChartDir-Ampliar espacio entre valores

Hola,

Gracias por tu ayuda, me funciono muy bien lo que dices, pero xq se ven los datos (en este caso las fechas) como borrosos?

Con respecto a los ceros, estuve buscando para que el vector cambie de tamaño de acuerdo a los datos que tenga y me encontre esta instruccion:
ReDim Preserve data1(final), pero ya la grafica me queda muy ancha, como pudiera estrecharla un poco

Que puedo hacer???

Gracias!!!!

Última edición por glory82; 12/11/2009 a las 10:36
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:48.