{"id":201,"date":"2015-11-02T16:44:10","date_gmt":"2015-11-02T16:44:10","guid":{"rendered":"http:\/\/www.nerdlingen.de\/?p=201"},"modified":"2018-10-21T20:46:49","modified_gmt":"2018-10-21T19:46:49","slug":"updating-sparklines-in-originc","status":"publish","type":"post","link":"https:\/\/www.nerdlingen.de\/?p=201","title":{"rendered":"Updating sparklines in OriginC"},"content":{"rendered":"<p>Ever wondered how to tell <a href=\"http:\/\/www.originlab.com\/\" target=\"_blank\">OriginLab<\/a> to update the <a href=\"http:\/\/www.originlab.com\/index.aspx?go=Products\/Origin\/91\/Sparklines\" target=\"_blank\">sparklines<\/a> after a custom import-filter (or whatever data-manipulating script) has been called?<\/p>\n<p>Well, you can call the &#8220;<a href=\"http:\/\/www.originlab.com\/doc\/X-Function\/ref\/sparklines\" target=\"_blank\">sparklines<\/a>&#8221; X-Function. The documentation is, as usual for OriginC, not the best and calling X-Functions with the wrong parameter will simply crash OriginLab, but it&#8217;s worth it&#8230;<\/p>\n<p>Code:<\/p>\n<pre class=\"brush: cpp; gutter: true\">bool call_UpdateSparklines_XF(Worksheet &amp;wks)\n{\n    \/\/ Create an instance of XFBase using the X-Function name.\n    XFBase xf(\"sparklines\");\n    if (!xf)\n        return false;\n \n    \/\/ Set the 'iw' argument. A worksheet for XFBase is referenced using a Pointer (not the name...)\n    if (!xf.SetArg(\"iw\", wks))\n        return false;\n \n    \/\/ Set the 'sel' argument.\n    if (!xf.SetArg(\"sel\", 0))\n        return false;\n \n    \/\/ Set the 'c1' argument, the first row to update. Counter starts at 1.\n    if (!xf.SetArg(\"c1\", 1))\n        return false;\n \n    \/\/ Set the 'sel' argument.\n    if (!xf.SetArg(\"c2\", wks.GetNumCols()))\n        return false;\n \n    \/\/ Call XFBase's 'Evaluate' method to execute the X-Function\n    if (!xf.Evaluate())\n        return false;\n \n    return true;\n}<\/pre>\n<p>You might also find this Forum-Entry useful, where some different possibilities are given: <a href=\"http:\/\/www.originlab.com\/forum\/topic.asp?TOPIC_ID=8875\" target=\"_blank\">OriginC-Forum \/ Sparklines<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever wondered how to tell OriginLab to update the sparklines after a custom import-filter (or whatever data-manipulating script) has been called? Well, you can call the &#8220;sparklines&#8221; X-Function. The documentation is, as usual for OriginC, not the best and calling &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.nerdlingen.de\/?p=201\"> <span class=\"screen-reader-text\">Updating sparklines in OriginC<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,8,4],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-english","category-originlab","category-software"],"_links":{"self":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201"}],"version-history":[{"count":3,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":280,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions\/280"}],"wp:attachment":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}