Author |
Topic  |
|
ovince
Yugoslavia
Posts |
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 |
|
Deanna
China
Posts |
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 |
 |
|
ovince
Yugoslavia
Posts |
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
China
Posts |
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 |
 |
|
|
Topic  |
|
|
|