DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

change line color in 3D diagram with points - e3DShapePoints

Solved!
Go to solution

How can I change the line color in a e3DShapePoints diagram type? I want to use one of the predefined global palettes.

 

I managed to switch the marker line color via:

 

Report.Sheets.Item(MySheetName).Objects.Item(MyDiagramName).Curves3D.Item(MyCurveName).Shape.Settings.Marker.Line.Color.ColorIndex = eColorIndexGlobalColorPalette3

 

but this will not enable the color legend unfortunately. Apparently there is no line object available in the curve settings.

Any suggestions?

0 Kudos
Message 1 of 11
(7,689 Views)

Hi Phex,

 

The "e3DShapePoints" 3D curve type you have chosen is for marker-only display.  There is no way to engage a line to be drawn with this curve type.  If you choose the color for this curve to be one of the global palettes, though, you will be able to display the color legend.  But if you want to see lines, you'll have to choose a different curve type.  Can you describe or post a picture of what sort of lines you want to see?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 11
(7,359 Views)

Hi Brad,

 

I do not want to connect the markers with lines. The picture shows what I want to produce:

legend

 

The problem is that I cannot access the line color object to change it from standard "red" to "global palette 3". This only works manually via the dialogue box.

linecolor.JPG

 

Is there any possibility to change the line color via script?

 

/Phex

0 Kudos
Message 3 of 11
(7,355 Views)

Hi Phex,

 

use the following example:

 

Dim oMy3DAxisSystem, oMy3DCurve, oMyPos, oMyShape
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")
Set oMy3DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject3DAxisSystem,"My3DAxisSystem")
Set oMyPos = oMy3DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMy3DCurve = oMy3DAxisSystem.Curves3D.Add(e3DShapePoints, "MyNew3DCurve")
Set oMyShape = oMy3DCurve.Shape
oMyShape.DataStructure = e3DDataStructureMatrix
oMyShape.XChannel.Reference = "[2]/[1]"
oMyShape.YChannel.Reference = "[2]/[2]"
oMyShape.ZChannel.Reference = "[2]/[3]"
oMyShape.Settings.Marker.Type = eMarkerCircle
oMyShape.Settings.Marker.Filling.UseCurveColor = False
Call oMyShape.Settings.Marker.Filling.SetPredefinedColor(ePredefinedColorred)

oMyShape.Settings.Marker.Line.UseCurveColor = False
oMyShape.Settings.Marker.Line.Color.ColorIndex = eColorIndexGreen
oMyShape.Settings.Marker.Filling.UseCurveColor = False
oMyShape.Settings.Marker.Filling.ColorIndex = eColorIndexblack

Call Report.Refresh()

 

The folowing set the color of the marker.

oMyShape.Settings.Marker.Line.Color.ColorIndex = eColorIndexGreen

oMyShape.Settings.Marker.Filling.ColorIndex = eColorIndexblack

 

This is very similar to any other diagramm: you have a line and a marker. Like Brad has sayed, these diagramm doesn`t draw any linesso you have to recolor the marker.

 

Kind Regards,

 

Philipp K.


AE | NI Germany

0 Kudos
Message 4 of 11
(7,321 Views)

Hi Philipp and thanks for your reply. Unfortunately it does not adress my problem.

I modified your code only by setting the UseCurveColor parameter to "TRUE":

 

Dim oMy3DAxisSystem, oMy3DCurve, oMyPos, oMyShape
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")
Set oMy3DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject3DAxis

System,"My3DAxisSystem")
Set oMyPos = oMy3DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMy3DCurve = oMy3DAxisSystem.Curves3D.Add(e3DShapePoints, "MyNew3DCurve")
Set oMyShape = oMy3DCurve.Shape
oMyShape.DataStructure = e3DDataStructureMatrix
oMyShape.XChannel.Reference = "[2]/[1]"
oMyShape.YChannel.Reference = "[2]/[2]"
oMyShape.ZChannel.Reference = "[2]/[3]"
oMyShape.Settings.Marker.Type = eMarkerCircle
oMyShape.Settings.Marker.Filling.UseCurveColor = True
Call oMyShape.Settings.Marker.Filling.SetPredefinedColor(ePredefinedColorred)

oMyShape.Settings.Marker.Line.UseCurveColor = True
oMyShape.Settings.Marker.Line.Color.ColorIndex = eColorIndexGreen
oMyShape.Settings.Marker.Filling.UseCurveColor = True
oMyShape.Settings.Marker.Filling.ColorIndex = eColorIndexblack

Call Report.Refresh()

 

 

Now you see all points in red, because the standard curve color is red. In order to change that I need to go manually into the Curve Properties and change the display color to "Global Palette 3", because this is what I want to see. So how can I achieve this by scripting?

 

/Phex

0 Kudos
Message 5 of 11
(7,318 Views)

Hi Phex,

 

I think I haven't get your problem.

 

When you go to th DIAdem help (Programmierreferenz > Objektorientierte Script-Schnittstellen > DIAdem-REPORT > Eigenschaften > Eigenschaft: ColorIndex für Color) you find the explanation of the property ColorIndex. It's an enum with the folowing entries:

 

Bestimmt die Farbe.
Aufzählung mit Schreib-/Lesezugriff und folgenden Auswahlbegriffen:

0

eColorIndexNone

Keine

1

eColorIndexBlack

Schwarz

2

eColorIndexRed

Rot

3

eColorIndexGreen

Grün

4

eColorIndexBlue

Blau

5

eColorIndexViolet

Violett

6

eColorIndexTurquoise

Türkis

7

eColorIndexGrey

Grau

8

eColorIndexYellow

Gelb

9

eColorIndexDarkRed

Dunkel-rot

10

eColorIndexDarkGreen

Dunkel-grün

11

eColorIndexDarkBlue

Dunkel-blau

12

eColorIndexDarkViolet

Dunkel-violett

13

eColorIndexDarkTurquoise

Dunkel-türkis

14

eColorIndexDarkGrey

Dunkel-grau

15

eColorIndexDarkYellow

Dunkel-gelb

16

eColorIndexWhite

Weiß

17

eColorIndexOtherColors

Andere Farben

18

eColorIndexPalette

Palette

19

eColorIndexGlobalColorPalette1

Globale Palette 1

20

eColorIndexGlobalColorPalette2

Globale Palette 2

21

eColorIndexGlobalColorPalette3

Globale Palette 3

22

eColorIndexFillEffects

Fülleffekte

 

When you change the value eColorIndexGreen to eColorIndexGlobalColorPalette3 you have choosen the global palette 3.

 

Kind Regards,

Philipp K.

 

AE | NI-Germany

0 Kudos
Message 6 of 11
(7,303 Views)

Yes you are right, I could change UseCurveColor back to "FALSE" and replace eColorIndexGreen with eColorIndexGlobalColorPalette3, but then I do not get my color legend. In order to achieve that I need to change the display color of the curve to eColorIndexGlobalColorPalette3, but obviously there is no object prepared for that or did I miss it...?

0 Kudos
Message 7 of 11
(7,301 Views)

Could anyone reproduce what I am trying to achieve ?


I would need to change the display color to "eColorIndexGlobalColorPalette3" in order to enable the color legend. How can I do that by script ?

0 Kudos
Message 8 of 11
(7,195 Views)
Solution
Accepted by topic author Phex

If you cange the color in the curve definition dialog for "points" this corresponds to the textcolor of the "points" because no line is available. (oMyShape.Extensions.Label.Font.Color.ColorIndex =eColorIndexGlobalColorPalette1)

Dim oMy3DAxisSystem, oMy3DCurve, oMyPos, oMyShape
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")
Set oMy3DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject3DAxisSystem,"My3DAxisSystem")
Set oMyPos = oMy3DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMy3DCurve = oMy3DAxisSystem.Curves3D.Add(e3DShapePoints, "MyNew3DCurve")
Set oMyShape = oMy3DCurve.Shape
oMyShape.DataStructure = e3DDataStructureMatrix
oMyShape.XChannel.Reference = "[2]/[1]"
oMyShape.YChannel.Reference = "[2]/[2]"
oMyShape.ZChannel.Reference = "[2]/[3]"
oMyShape.Settings.Marker.Type = eMarkerCircle
oMyShape.Settings.Marker.Filling.UseCurveColor = True
Call oMyShape.Settings.Marker.Filling.SetPredefinedColor(ePredefinedColorred)

oMyShape.Extensions.Label.Font.Color.ColorIndex =eColorIndexGlobalColorPalette1
'oMyShape.Settings.Marker.Line.UseCurveColor = True
'oMyShape.Settings.Marker.Line.Color.ColorIndex = eColorIndexGreen
'oMyShape.Settings.Marker.Filling.UseCurveColor = True
'oMyShape.Settings.Marker.Filling.ColorIndex = eColorIndexblack
oMy3DAxisSystem.ColorLegend.Visible = True

Call Report.Refresh()

 

This is a little bit confusing.

 

Hope this helps

 

Winfried

 

0 Kudos
Message 9 of 11
(7,189 Views)

Awesome! Thank you so much, that solved it.

/Phex

0 Kudos
Message 10 of 11
(7,186 Views)