summaryrefslogtreecommitdiffstats
path: root/src/bltGraph.C
diff options
context:
space:
mode:
authorjoye <joye>2014-04-18 17:07:46 (GMT)
committerjoye <joye>2014-04-18 17:07:46 (GMT)
commitdd944a4a6dbca67e4a661dfe5ef243d199abd833 (patch)
treeaed1e7ba92ed7d9f4bab9c33de468794753504cf /src/bltGraph.C
parent3f52c6e39673ce7866d8c4dfbc8b87ce8f6567ec (diff)
downloadblt-dd944a4a6dbca67e4a661dfe5ef243d199abd833.zip
blt-dd944a4a6dbca67e4a661dfe5ef243d199abd833.tar.gz
blt-dd944a4a6dbca67e4a661dfe5ef243d199abd833.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltGraph.C')
-rw-r--r--src/bltGraph.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 02ac74a..4de7d4f 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -1179,6 +1179,38 @@ int Graph::createAxes()
return TCL_OK;
}
+int Graph::createAxis(int objc, Tcl_Obj* const objv[])
+{
+ char *string = Tcl_GetString(objv[3]);
+ if (string[0] == '-') {
+ Tcl_AppendResult(interp_, "name of axis \"", string,
+ "\" can't start with a '-'", NULL);
+ return TCL_ERROR;
+ }
+
+ int isNew;
+ Tcl_HashEntry* hPtr =
+ Tcl_CreateHashEntry(&axes_.table, string, &isNew);
+ if (!isNew) {
+ Tcl_AppendResult(interp_, "axis \"", string, "\" already exists in \"",
+ Tcl_GetString(objv[0]), "\"", NULL);
+ return TCL_ERROR;
+ }
+
+ Axis* axisPtr = new Axis(this, Tcl_GetString(objv[3]), MARGIN_NONE, hPtr);
+ if (!axisPtr)
+ return TCL_ERROR;
+
+ Tcl_SetHashValue(hPtr, axisPtr);
+
+ if ((Tk_InitOptions(interp_, (char*)axisPtr->ops(), axisPtr->optionTable(), tkwin_) != TCL_OK) || (AxisObjConfigure(interp_, axisPtr, objc-4, objv+4) != TCL_OK)) {
+ delete axisPtr;
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
void Graph::destroyAxes()
{
Tcl_HashSearch cursor;