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
 turn off speed mode

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
Dodo1608 Posted - 12/20/2010 : 09:49:44 AM
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

3   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 12/21/2010 : 9:48:35 PM
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
Dodo1608 Posted - 12/21/2010 : 06:31:33 AM
Hello Penn,

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

Dodo
Penn Posted - 12/20/2010 : 8:49:49 PM
Hi Dodo,

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

Penn

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