Autor Beitrag
Lux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mi 06.04.05 08:10 
Hallo Leute...
Der Topic klingt vielleicht etwas bescheuert aber na ja :)

Ich hab da eine Frage.
Hat jemand von euch schonmal mit dem Chartwizard von Excel gearbeitet?

Ich wollte in meinem Delphi Programm ein Diagramm ausgeben lassen. Da in D2K5Pers. nun mal kein TChart vorhanden ist, muss ich das über Excel machen mit einem OLE Container.
Das klappt auch soweit alles wunderbar, hab da ein tutorial gefunden und bin soweit glücklich.

Allerdings ist die Ausgabe des Diagramms falsch. Er macht ein Säulendiagramm und ich möchte ein Liniendiagramm haben.
Meine Frage. Kann mir einer sagen, was ich dafür im folgenden Code ändern muss?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
Excel.Charts[1].Chartwizard
(excel.Worksheets['Tabelle1'].Range['A1:E5'],
-4100, 4, 2, 1, 0, 2, 'eigenes Diagramm',
'x', 'y', '');


Worksheets['Tabelle1'].Range['A1:E5']: Das verstehe ich ja: Für das Diagramm benutze den Bereich A1 bis E5 aus dem Tabellenblatt Tabelle 1

-4100: Die kapier ich wieder nicht.

4: Hiermit wird angegeben welches der verschiedenen Diagrammarten man in einem Bereich nehmen will (Bsp.: im Säulendiagramm die Art 3D-Säulen, 3D-Säulen in 100% usw.)

2: Verstehe ich nicht

1: Verstehe ich nicht

0: Hiermit wird angegeben welche Beschriftungsart die Linien bekommen sollen

2: Hiermit wird angegebe ob die einzelnen angegebenen Linien eine Beschriftung bekommen sollen oder nicht

eigenes Diagramm: Der Name des Diagrammes

x: Bezeichnung der X-Achse

y: Bezeichnung der Y-Achse

'': Keine Ahnung was hier stehen soll... Im Tutorial war es leer...

Könnt ihr mir da helfen?

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mo 11.04.05 13:40 
Weiß da niemand einen Rat? :(

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 11.04.05 14:04 
Hallo!

Die nötigen Infos findest du in der VBA Hilfe von Excel.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 11.04.05 14:06 
Zitat:

-4100: Die kapier ich wieder nicht.

das kommt davon, wenn man es nicht für nötig hält, die konstanten zuverwenden ;).

Mach folgendes: zeichne dir ein Makro auf (Excel-extras) erstell dir dein diagramm, wie du es haben möchtest. Gugg es dir anschließend in VB an und dann wird auch die Umsetzung nach Delphi kein Problem mehr sein. Da wird dann sicherlich nich 2 und 1 da stehen.

Wenn immer noch nicht klappt, meld dich einfach wieder.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mo 11.04.05 14:18 
Alles klar!
Vielen dank! Ich werde mir das mal zu Gemüte tun :)

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mo 11.04.05 14:41 
Aaalso!
Ich hab nun einmal in die Hilfe geschaut und einmal auch ein Makro erstellen lassen:
In der Hilfe habe ich folgendes entdeckt:
Zitat:
ChartWizard(Source, Gallery, Format, PlotBy, CategoryLabels, SeriesLabels, HasLegend, Title, CategoryTitle, ValueTitle, ExtraTitle)

da habe ich herausgefunden, das für mich wohl der Wert Galery relevant ist. Denn der besagt folgendes:
Zitat:
Gallery
Optionaler XlChartType-Wert. Der Diagrammtyp.

Dort findet man dann folgende Konstanten:
Zitat:

XlChartType kann eine der folgenden XlChartType-Konstanten darstellen.
xlArea
xlBar
xlColumn
xlLine
xlPie
xlRadar
xlXYScatter
xlCombination
xl3DArea
xl3DBar
xl3DColumn
xl3DLine
xl3DPie
xl3DSurface
xlDoughnut
xlDefaultAutoFormat

Alles klar.
Nun habe ich auch ein Makro erstellt, um herauszufinden, wie ich denn nun den Wert für mein xlLine herausbekomme. Denn das ist die Konstante, die ich dafür benutzen möchte.

Allerdings hat er mir beim erstellen eines Makros nur folgendes rausgeschmissen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
    Range("A1:B11").Select
    Charts.Add
    ActiveChart.ChartType = xlLine
    ActiveChart.SetSourceData Source:=Sheets("Tabelle1").Range("A1:B11"), PlotBy _
        :=xlColumns
    ActiveChart.SeriesCollection(1).Name = "=""Hallo"""
    ActiveChart.SeriesCollection(2).Name = "=""welt"""
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Tabelle1"
    ActiveChart.HasDataTable = False

Also von einem Wert keine Spur. in VB kann man anscheinend einfach nur ChartType = xlLine sagen und das wars... Leider hat er mir hier auch nichts mit einem Chartwizard aufgebaut, sondern es anders gelöst.

Meine Frage:
Es muss ja was mit dem Wert -4100 zu tun haben, wenn ich mich nun nicht irre... Aber wie bekomme ich nun den richtigen Wert für mein Liniendiagramm heraus?

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 11.04.05 14:44 
Die Konstanten findest du z.B in Word2000.pas od. WordXp.pas od. Wor97.pas usw.
Oder einfach mal Googeln nach Suche bei Google XLPIE DELPHI

Const xlArea = 1
Const xlBar = 2
Const xlColumn = 3
Const xlLine = 4
Const xlPie = 5
Const xlRadar = -4151
Const xlXYScatter = -4169
Const xlCombination = -4111
Const xl3DArea = -4098
Const xl3DBar = -4099
Const xl3DColumn = -4100
Const xl3DLine = -4101
Const xl3DPie = -4102
Const xl3DSurface = -4103
Const xlDoughnut = -4120
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mo 11.04.05 14:57 
Da wäre ich nun nie darauf gekommen! Vielen dank! Klappt nun wunderbar! Damit habt ihr mich ein ganzes Stück weiter gebracht.

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.