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
 turn off speed mode
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Dodo1608

2 Posts

Posted - 12/20/2010 :  09:49:44 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

Hello,

I want to creat a plot with more then 3000 datapoints.
This is the code:

main()
{
Datasheet_ImportASCII_Ex1();
add_curve_to_graph_layer_ex1();

}

void Datasheet_ImportASCII_Ex1()
{
ASCIMP ai;
string strFile = GetOpenBox("*.txt"); // or "*.txt"
if(AscImpReadFileStruct(strFile, &ai)==0)
{
ai.iAutoSubHeaderLines = 0;

ai.iSubHeaderLines = 4;
ai.nLongNames = ai.iHeaderLines+1 ;
ai.nUnits = ai.iHeaderLines + 2;
ai.iMaxLabels = 0; // Not set any header line to Comments label
Worksheet wks;
wks.Create();
wks.ImportASCII(strFile, ai);
wks.SetName("Sheet4");
Page pg = Project.Pages(0);
pg.SetLongName("Data");
pg.SetName("Data");
}

}

void add_curve_to_graph_layer_ex1()
{
WorksheetPage wksPage = Project.WorksheetPages(0);
Worksheet wks = wksPage.Layers(0);
if(wks)
{

Curve crvPlotted( wks, 1 );
GraphPage gp;
gp.Create("ORIGIN");
GraphLayer gl = gp.Layers();

gp.SetLongName("GraphData");
gp.SetName("GraphData");



if(crvPlotted && gl)
{

int nColor = SYSCOLOR_BLUE;
bool bRescale = true;
int nPlotType = IDM_PLOT_SCATTER;
bool bOK = add_curve_to_graph_layer(crvPlotted, gl, nColor, bRescale, nPlotType);
}





Axis axisY = gl.YAxis;
Axis axisX = gl.XAxis;
Tree tr;
Tree tr2;



// Show major grid
TreeNode trProperty = tr.Root.Grids.HorizontalMajorGrids.AddNode("Show");
trProperty.nVal = 1;
tr.Root.Grids.HorizontalMajorGrids.Color.nVal = RGB2OCOLOR(RGB(100, 100, 220));
tr.Root.Grids.HorizontalMajorGrids.Style.nVal = 1; // Solid
tr.Root.Grids.HorizontalMajorGrids.Width.dVal = 1;

// Show minor grid
trProperty = tr.Root.Grids.HorizontalMinorGrids.AddNode("Show");
trProperty.nVal = 1;
tr.Root.Grids.HorizontalMinorGrids.Color.nVal = SYSCOLOR_GREEN; // Green
tr.Root.Grids.HorizontalMinorGrids.Style.nVal = 2; // Dot
tr.Root.Grids.HorizontalMinorGrids.Width.dVal = 0.3;

// Show Right Axis
trProperty = tr.Root.Ticks.RightTicks.AddNode("Show");
trProperty.nVal = 1;
tr.Root.Ticks.RightTicks.Color.nVal = SYSCOLOR_BLACK;
tr.Root.Ticks.RightTicks.Width.dVal = 1.5;
tr.Root.Ticks.RightTicks.Major.nVal = 1; // 0: In and Out
tr.Root.Ticks.RightTicks.Minor.nVal = 1; // 2: Out
tr.Root.Ticks.RightTicks.Style.nVal = 0; // Solid

if(0 == axisY.UpdateThemeIDs(tr.Root))
{
bool bRet = axisY.ApplyFormat(tr, true, true);
}





TreeNode tr2Property = tr2.Root.Grids.VerticalMajorGrids.AddNode("Show");
tr2Property.nVal = 1;
tr2.Root.Grids.VerticalMajorGrids.Color.nVal = RGB2OCOLOR(RGB(100, 100, 220));
tr2.Root.Grids.VerticalMajorGrids.Style.nVal = 1; // Solid
tr2.Root.Grids.VerticalMajorGrids.Width.dVal = 1;

// Show minor grid
tr2Property = tr2.Root.Grids.VerticalMinorGrids.AddNode("Show");
tr2Property.nVal = 1;
tr2.Root.Grids.VerticalMinorGrids.Color.nVal = SYSCOLOR_GREEN; // Green
tr2.Root.Grids.VerticalMinorGrids.Style.nVal = 2; // Dot
tr2.Root.Grids.VerticalMinorGrids.Width.dVal = 0.3;

// Show Top Axis
tr2Property = tr2.Root.Ticks.TopTicks.AddNode("Show");
tr2Property.nVal = 1;
tr2.Root.Ticks.TopTicks.Color.nVal = SYSCOLOR_BLACK;
tr2.Root.Ticks.TopTicks.Width.dVal = 1.5;
tr2.Root.Ticks.TopTicks.Major.nVal = 1; // 0: In and Out
tr2.Root.Ticks.TopTicks.Minor.nVal = 1; // 2: Out
tr2.Root.Ticks.TopTicks.Style.nVal = 0; // Solid

if(0 == axisX.UpdateThemeIDs(tr2.Root))
{

bool bRet2 = axisX.ApplyFormat(tr2, true, true);
}

}
}

My Problem is, that the plot will always create in the speed mode. Is there a possibility to turn off the speed mode?

Thank you
Dodo

Penn

China
644 Posts

Posted - 12/20/2010 :  8:49:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dodo,

Please refer to this page on how to turn off speed mode.

Penn
Go to Top of Page

Dodo1608

2 Posts

Posted - 12/21/2010 :  06:31:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Penn,

I tried this code, but its unfortunately not working in my script. Do you have any other ideas?

Dodo
Go to Top of Page

Penn

China
644 Posts

Posted - 12/21/2010 :  9:48:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dodo,

Sorry that I did not see that your plot data was from worksheet. However the example is used for the plot whose data is from matrix. I have changed one line of the example, and now it can work for the graph made from worksheet. Please try the following code.

void TurnOffSpeedMode()
{
    GraphLayer gl = Project.ActiveLayer();
    if(gl)
    {
        Tree trFormat;
        trFormat = gl.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
        
        // TreeNode trSpeed = trFormat.Root.Speed.Matrix;
        // if the plot data is from worksheet, 
        // use the following line instead of the line above
        TreeNode trSpeed = trFormat.Root.Speed.Worksheet;
        
        if( !trSpeed )
            return;
        
        if( trSpeed.nVal )
        {
            trSpeed.nVal = 0;
            if( gl.ApplyFormat(trFormat, TRUE, TRUE) )
                out_str("Turn off speed mode!");
            
        }
        else
        {
            out_str("Speed mode already be turn off!");
        }       
    }
}


Penn
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