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
 Plotting columns graph

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
aragues Posted - 10/05/2005 : 10:48:32 AM
Hello everybody

I've got a little problem using Origin. I wanna plot three columns, regarding to three differents curves, in the same graphic but using one color for each column. I mean, I need column one is red, column two is blue and column three is green.
I used SetColor in order to get each column in its color, but all columns got identical (red) color.

This was what I proved:
void plot()
{
GraphPage grph;
BOOL bOK = grph.Create("Column", CREATE_VISIBLE_SAME);
grph.Rename("graphic");

GraphLayer grlay = grph.Layers(0);

Curve cd("data_Va");
int mPlot = grlay.AddPlot(cd, 3);
if(mPlot >= 0)
grlay.DataPlots(mPlot).SetColor(1, TRUE);

Curve ce("data_Vb");
int kPlot = grlay.AddPlot(ce, 3);
if(kPlot >= 0)
grlay.DataPlots(kPlot).SetColor(3, TRUE);

Curve cf("data_Vc");
int jPlot = grlay.AddPlot(cf, 3);
if(jPlot >= 0)
grlay.DataPlots(jPlot).SetColor(2, TRUE);
}

Can anyone help me?
Thanks.
2   L A T E S T    R E P L I E S    (Newest First)
aragues Posted - 10/06/2005 : 05:44:29 AM
I've eventually got it!
Thank you very much
easwar Posted - 10/05/2005 : 3:23:18 PM
Hi,

The SetColor() method for DataPlot works only for line and scatter plots.

What version of Origin are you running?

The solution below is for 7.5.

One easy way to acheive what you want is as follows:
1> First manually create a column graph with multiple columns so that you get a grouped column plot
2> Go to Plot Details by double-clicking on the graph and then on the Group tab, click on the Details columns to the right of Fill Color entry in the table (the Increment checkbox will be checked).
3> You will see a button with text "..." and when you click on that, you get a dialog where you can customize your group color list
4> Change the color ordering to what you want, then right-click inside that dialog and select Save. A dialog pops up asking for name. Give it a name such as MyColors

By doing the above, you are creating your own incremental color theme. The theme file will be saved to disk in your User Files area under the subfolder called \Themes.

Once you have created such a theme, you can then apply the color sequence to your plot.

You can apply the color theme manually by just clicking and selecting a grouped plot, then clicking on the drop-down list called Font/Line/BorderColor in the Style toolbar and then towards the end of the list just pick your color theme by the name you used to save earlier.

Also once an incremental theme has been created, you can programmatically apply that to a graph page, such as with code below:


void plot()
{
GraphPage grph;
BOOL bOK = grph.Create("Column", CREATE_VISIBLE_SAME);
grph.Rename("graphic");

GraphLayer grlay = grph.Layers(0);

Curve cd("data_Va");
Curve ce("data_Vb");
Curve cf("data_Vc");
grlay.AddPlot(cd);
grlay.AddPlot(ce);
grlay.AddPlot(cf);
grlay.GroupPlots(0);
grlay.Rescale();
string strThemeFile = GetAppPath() + "themes\\mycolors.oth";
grlay.GetPage().ApplyFormat(strThemeFile);

}



Easwar
OriginLab



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