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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Plotting columns graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

aragues

Spain
Posts

Posted - 10/05/2005 :  10:48:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

easwar

USA
1965 Posts

Posted - 10/05/2005 :  3:23:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Go to Top of Page

aragues

Spain
Posts

Posted - 10/06/2005 :  05:44:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I've eventually got it!
Thank you very much
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000