Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2009, 17:57
glory82
 
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.