473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

OWC 10 chChartTypeLineMarkers HELP

Hi,

I've wrote the code GRAPHIC_ENGINE.ASPX.VB
but it doesn't work properly, because the chart appears only with one
dataline (the last line resulting from the query). Can anyone tell me
what i'm doing wrong?

Thanks in advance.
Marco Viana
Portugal

GRAPHIC_ENGINE.ASPX.VB:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.OWC
Public Class graphic_engine
Inherits System.Web.UI.Page
Protected WithEvents chartspace1 As OWC.ChartSpace

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.Buffer = True

'''*********************************************** *************
'''*** Query building
'''*********************************************** *************

Dim v_campanha As String
v_campanha = Request.QueryString("idcampanha")
Dim a_campanha() As String
a_campanha = Split(v_campanha, ",")
Dim v_estacao As String
v_estacao = Request.QueryString("idestacao")
Dim a_estacao() As String
a_estacao = Split(v_estacao, ",")
Dim v_parametro As String
v_parametro = Request.QueryString("idparametro")

Dim v_profundidade As String
v_profundidade = Request.QueryString("idprofundidade")

Dim a_sql_series(UBound(a_estacao) + 1, 1) As String

'Criar primeira linha do array com uma query que vai criar
todas as campanhas
a_sql_series(0, 0) = "SELECT nome, 0 AS valor FROM l_periodo
ORDER BY codigo"
a_sql_series(0, 1) = "SELECT count(*) FROM l_periodo"

Dim j As Integer
j = 0

Dim k As Integer
k = 1

While j <= UBound(a_estacao)
a_sql_series(j + 1, 0) = "SELECT periodo,cast(valor AS
float),parametro,profund,unid FROM l_medicoes WHERE parametro_codigo="
& v_parametro & " AND profund='" & v_profundidade & "' AND
local_codigo=" & a_estacao(j) & " AND (periodo_codigo = " &
a_campanha(0) & " "
'a_sql_series(j, 0) = "SELECT periodo_codigo,cast(valor AS
float),parametro,profund,unid FROM l_medicoes WHERE parametro_codigo="
& v_parametro & " AND profund='" & v_profundidade & "' AND
local_codigo=" & a_estacao(j) & " AND (periodo_codigo = " &
a_campanha(0) & " "

a_sql_series(j + 1, 1) = "SELECT count(*) FROM l_medicoes
WHERE parametro_codigo=" & v_parametro & " AND profund='" &
v_profundidade & "' AND local_codigo=" & a_estacao(j) & " AND
(periodo_codigo = " & a_campanha(0) & " "

While k <= UBound(a_campanha)
a_sql_series(j + 1, 0) = a_sql_series(j + 1, 0) & " OR
periodo_codigo = " & a_campanha(k) & " "
a_sql_series(j + 1, 1) = a_sql_series(j + 1, 1) & " OR
periodo_codigo = " & a_campanha(k) & " "

If k = UBound(a_campanha) Then
a_sql_series(j + 1, 0) = a_sql_series(j + 1, 0) &
") "
a_sql_series(j + 1, 1) = a_sql_series(j + 1, 1) &
") "
End If
k = k + 1
End While
a_sql_series(j + 1, 0) = a_sql_series(j + 1, 0) & " ORDER
BY periodo_codigo"
j = j + 1
k = 1
End While
'''*********************************************** *************
'''*** End Query Building
'''*********************************************** *************

'declare chartsapce, chart and "series objects" of OWC

'new chartspace
Dim chartspace1
chartspace1 = New OWC.ChartSpace()
chartspace1.Clear()

'new chart
chartspace1.charts.add()

'DB Connection

Dim ConnStr As String
ConnStr = f_conexion_string_bd(Session("username"),
Session("password"))
Dim PubsConn As New SqlClient.SqlConnection(ConnStr)
PubsConn.Open()

'Loop--> creation of graphic
Dim m As Integer
m = 0
While m <= UBound(a_sql_series)
Dim countCmd As New SqlCommand(a_sql_series(m, 1),
PubsConn)

Dim perfilCmd As New SqlClient.SqlCommand(a_sql_series(m,
0), PubsConn)

'Declare DataReader object
Dim data_reader As SqlClient.SqlDataReader

'Declare variables
Dim i As Integer
Dim numpoints 'number of datapoints
Dim categories() 'array with x values
Dim values() 'array with y values
'1st: find number of datapoints
data_reader = countCmd.ExecuteReader()
data_reader.Read()
numpoints = data_reader.GetValue(0)
data_reader.Close()
'Redim arrays
ReDim values(numpoints - 1)
ReDim categories(numpoints - 1)

'2nd: bind arrays
data_reader = perfilCmd.ExecuteReader
i = 0

While data_reader.Read
categories(i) = data_reader.GetValue(0)
'Response.Write(categories(i) & "<br>")
values(i) = data_reader.GetValue(1)
'Response.Write(values(i) & "<p>")
i = i + 1
End While


'3th create graphs
chartspace1.charts(0).seriescollection.add(m)

chartspace1.charts(0).seriescollection(m).type =
chartspace1.constants.chChartTypeLineMarkers
chartspace1.Charts(0).SeriesCollection(m).SetData( OWC.ChartDimensionsEnum.chDimCategories,
OWC.ChartSpecialDataSourcesEnum.chDataLiteral, categories)
chartspace1.Charts(0).SeriesCollection(m).SetData( OWC.ChartDimensionsEnum.chDimValues,
OWC.ChartSpecialDataSourcesEnum.chDataLiteral, values)
data_reader.Close()
m = m + 1
End While
PubsConn.Close()

'Format chart
With chartspace1.Charts(0)
.HasLegend = True
.Legend.Position =
OWC.ChartLegendPositionEnum.chLegendPositionBottom
.HasTitle = True
.Title.Caption = "Gráfico"
.Axes(0).HasTitle = True
.Axes(0).Title.Caption = "Campanha"
.Axes(1).HasTitle = True
.Axes(1).Title.Caption = "parametro"
End With

With chartspace1.Charts(0).SeriesCollection(0)

.line.color = "white"
.interior.color = "white"
.border.color = "white"
.caption = ""
.Marker.Style = ChartMarkerStyleEnum.chMarkerStyleNone
'.DataLabelsCollection.Add()
End With
With chartspace1.Charts(0).SeriesCollection(1)
'.line.color = "black"
'.zorder = 200

End With
'chartspace1.Charts(0).SeriesCollection(2).

'Legends
Dim n As Integer
n = 1
Dim sql_estacao As String

While n <= UBound(a_estacao) + 1
sql_estacao = "SELECT nome FROM l_local WHERE codigo=" &
a_estacao(n - 1)
Dim estacaoCmd As New SqlClient.SqlCommand(sql_estacao,
PubsConn2)
Dim lista_estacao As SqlClient.SqlDataReader
lista_estacao = estacaoCmd.ExecuteReader()
lista_estacao.Read()
chartspace1.Charts(0).SeriesCollection(n).caption =
lista_estacao.GetValue(0)
lista_estacao.Close()

n = n + 1

End While
PubsConn2.Close()

Response.ContentType = "image/gif"
Response.Expires = 0
Response.BinaryWrite(chartspace1.GetPicture("gif", 600, 400))

Response.End()


End Sub

End Class
Nov 17 '05 #1
0 2202

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
0
by: MNFV | last post by:
Hi, I've wrote the code GRAPHIC_ENGINE.ASPX.VB but it doesn't work properly, because the chart appears only with one dataline (the last line resulting from the query). Can anyone tell me what...
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
8
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.