Information générale
Catégorie:
COM/DCOM et OLE Automation
I created a chart and saved it in a General field
Later the user wants to change the way it is ploted
from Row to Column in a form selecting one option
button of the form.
Problem:
I dont know how to do it. Allways returns error: Unknow name
I tried those 3 codes to plot the chart in the form
1) THISFORM.Olbgrafico.ChartArea.PlotArea.PlotBy = xlColumns
2) THISFORM.Olbgrafico.PlotArea.PlotBy = xlColumns
3) THISFORM.Olbgrafico.PlotBy = xlColumns
Nothig worked, why ??
Could someone help me please.
TIA
Below is the code I wrote
A) Saved the origial graph
Scan
lcData = lcData + ALLTRIM(SUBSTR(TTOC(Query1.datahora),1,10))
lcData = lcData + TAB
lcData = lcData + ALLTRIM(STR(Query1.valor)) + CRLF
Endscan
Select graf
Append GENERAL grafico DATA lcData CLASS "MSGRAPH.CHART"
B) Code to change Plot By
#DEFINE xlNone -4142 && p/ remover a borda do grafico
#DEFINE xlCategory 1
#DEFINE xlValue 2
#DEFINE xlPrimary 1
#DEFINE xlLine 4
#DEFINE xlLineStyleNone -4142
#DEFINE xlColumns 2 && como vai plotar o grafico
#DEFINE xlRows 1 && como vai plotar o grafico
* Type of graph
THISFORM.Olbgrafico.ChartType = xlLine
* Title
THISFORM.Olbgrafico.HasTitle = .T.
WITH THISFORM.Olbgrafico.ChartTitle
.CAPTION = ALLTRIM(graf.NOME) + " / " + ALLTRIM(graf.especie)
.FONT.SIZE = 18
.FONT.NAME = "Arial"
.FONT.COLOR = RGB(255,0,0)
ENDWITH
* Legend
THISFORM.Olbgrafico.HasLegend = .F.
* change size of dates
WITH THISFORM.Olbgrafico.Axes(xlCategory, xlPrimary).TickLabels
.FONT.SIZE = 8
.ORIENTATION = 65
.FONT.BOLD = .T.
ENDWITH
* Type of plot ( plot by )
THISFORM.Olbgrafico.PlotBy = xlColumns
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement