09-25-2017 09:44 AM
Hi,
(Diadem 2015)
I am trying to apply the color of a curve in VIEW to a curve in REPORT.
This line returns the color of the curve in VIEW to as a string, for example "red"
curveCol = View.Sheets(4).Areas(1).DisplayObj.Curves2D(5).Color
However, I cannot figure out how to apply this color to a curve in REPORT. REPORT appears to expect something like: -
Report.Sheets("New").Objects("2DAxis5").Curves2D(1).Shape.Settings.Line.Color.SetPredefinedColor(6)
or
Report.Sheets("New").Objects("2DAxis5").Curves2D(1).Shape.Settings.Line.Color.SetPredefinedColor(ecolorindexRed)
or colors expressed in RGB format.
How can I use the color obtained from View in Report?
Can anyone help please?
Thank you!
Thomas
Solved! Go to Solution.
09-26-2017 03:44 PM
Thomas,
You are correct in noticing that the properties for VIEW and REPORT are different. There was more reason to give more color flexibility in REPORT than VIEW, since it was designed to produce the final versions of diagrams.
Since you are already using scripting, it should be fairly easy to write a select statement that assigns the RGB color values to the strings that VIEW returns. Is this an option for you to use? Let me know if you have questions!
Thanks,
aprillest
09-27-2017 02:04 AM
Hi aprillest,
Thanks for the reply.
Yes, I could write a script to convert the colours to RGB, but am I not just missing some simple variable? The report 'D2CURVECOLOR' variable works if I format my script like this: -
call GraphObjNew("2D-Axis","2DAxis1")
call GraphObjOpen("2DAxis1")
call GraphObjNew("2D-Curve","New_Curve1")
call GraphObjOpen("New_Curve1")
D2CChnXName = View.Sheets(1).Areas(1).DisplayObj.Curves(1).XChannelName
D2CChnYName = View.Sheets(1).Areas(1).DisplayObj.Curves(1).YChannelName
D2CURVECOLOR = View.Sheets(1).Areas(1).DisplayObj.Curves(1).Color
call GraphObjClose("New_Curve1")
call GraphObjClose("2DAxis1")
but then I have to use GraphObjOpen and so on, which I was hoping to avoid. Is there a variable like D2CURVECOLOR which I can use with OOP methods without having to open and close graph objects?
Thanks!
Best regards,
Thomas
09-27-2017 02:39 PM
Thomas,
Nope, you're not missing anything. VIEW and REPORT were developed on different code bases, so they've each got a unique implementation of the curve color. This makes it a little more difficult to move between the two, but makes it a lot easier to stay backwards-compatible. It's up to you whether you'd rather use the D2CURVECOLOR or write up a select case.
Thanks,
aprillest
09-28-2017 10:42 AM
Hi aprillest,
Many thanks for the clarification!
Regards
thomas