The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 color-code

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ovince Posted - 10/01/2006 : 2:17:18 PM
hi All,

I would like to color-code (color-map) my graphs. I have found a fine tutorial example code that works fine but
I would like to improve it in 2 points:


1. The code does not provide color scale on the graphs. How to do it in OC?

2. How to customise the color-code? Namely, in the 4th column I already have discrete values
(0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6) and I would like to assign color-codes exactly to these numbers?
How to achive this?

Here is the short code:

void graph_colorMapping()
{
uint iWksCount = Project.WorksheetPages.Count();
vector<string> vWksName(iWksCount);

int ii = 0;
foreach (WorksheetPage pg in Project.WorksheetPages)
{
vWksName[ii++] = pg.GetName();
}

for (ii=0; ii<iWksCount; ii++)
{
string name = vWksName[ii];
out_str(name);
Worksheet wks(name);


// Create a new graph page
GraphPage gpg;
gpg.Create();
// Point to layer 1
GraphLayer gly = gpg.Layers(0);
// Make a curve object from cols 1, 2 of wks
Curve crv(wks, 0, 1);
// Plot curve as scatter plot
gly.AddPlot(crv, IDM_PLOT_SCATTER);
// Point to the data plot object for the plot
DataPlot dp = gly.DataPlots(-1);
// Change the edge color setting to color map based on col 3
dp.Curve.Symbol.EdgeColor.nVal = 4194405+1;
// Rescale the layer
gly.Rescale();
}

}



thank you in advance
oliver
3   L A T E S T    R E P L I E S    (Newest First)
Deanna Posted - 10/08/2006 : 03:00:30 AM
Sorry, I made a mistake. 4194405 is for color mapping, and 100 is for color indexing. The latter uses integer numbers for color code (e.g. 2 for red and 4 for blue); while the former is supports color mixing. That is also the reason why only the former supports color scale.

It seems that the code
dp.Curve.Symbol.EdgeColor.nVal = 4194405+1;
LT_execute("run.section(Standard,Spectrum);");

works fine in your case. Please use it.

Numbers like 4194405 and 100 are special offsets used for formats. I regret to say that current help files do not contain information about them. We will consider adding it to our knowledge base later, and will also suggest our colleagues to put it in our future product. Thank you very much.

Deanna
OriginLab Technical Services

Edited by - Deanna on 10/08/2006 05:36:29 AM
ovince Posted - 10/08/2006 : 02:35:05 AM
hello Deanna,

Thank you. Let me try to understand how these things work.

1. So far I have used

dp.Curve.Symbol.EdgeColor.nVal = 4194405+1;

and now

dp.Curve.Symbol.EdgeColor.nVal = 100 + 2;


What are these numbers (100 and 4194405)? I assume some internal codes to Origin C for a particular task. Are there any other number that one should be aware?


2. I have used a combination like

dp.Curve.Symbol.EdgeColor.nVal = 4194405+1;
LT_execute("run.section(Standard,Spectrum);");

which lunch the color scale (but arbitrary scaled). Now the combination

dp.Curve.Symbol.EdgeColor.nVal = 100 + 2;
LT_execute("run.section(Standard,Spectrum);");

does not work. Why is that?

Thank you
oliver
Deanna Posted - 10/07/2006 : 10:02:00 PM
Hi Oliver,

1. Currently, color scale is not supported in scatter plots. I guess there is some work-around. I will try to figure it out later.

2. To customise the color-mapping, use:
dp.Curve.Symbol.EdgeColor.nVal = 100 + ColumnOffset;
where ColumnOffset is the differences between the column that has the color mapping information and the column that has the Y data. In your case, this value should be equal to 4 - 2 = 2

3. Please use integer values for color mapping. You can double the values (0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6) before using them as color mapping values.

Deanna
OriginLab Technical Services

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000