{"id":118,"date":"2010-12-29T11:33:00","date_gmt":"2010-12-29T17:33:00","guid":{"rendered":"https:\/\/www.chrystalsander.com\/blog\/?p=118"},"modified":"2010-12-29T11:33:00","modified_gmt":"2010-12-29T17:33:00","slug":"create-graph-data-using-a-two-dimensional-array","status":"publish","type":"post","link":"https:\/\/www.chrystalsander.com\/blog\/?p=118","title":{"rendered":"Create Graph Data Using A Two-Dimensional Array"},"content":{"rendered":"<p>In this example, I am using a two-dimensional array to provide attributes for a graph from <a href=\"http:\/\/www.fusioncharts.com\/\" target=\"_blank\" rel=\"noopener\">Fusion Charts<\/a> :<\/p>\n<p>    \/*Store sales data*\/<br \/>   <span style=\"font-family:courier new;\">string[,] arrData = new string[4, 2];<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[0, 1] = &#8220;Annual Cash Compensation&#8221;;<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[1, 1] = &#8220;Annual LTI Compensation&#8221;;<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[2, 1] = &#8220;Current Financial Protection&#8221;;<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[3, 1] = &#8220;Future Financial Security&#8221;;<br \/><\/span><\/p>\n<p>    \/*Store sales amounts*\/<\/p>\n<p>    <span style=\"font-family:courier new;\">arrData[0, 2] = PercentDC.ToString();<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[1, 2] = PercentLT.ToString();<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[2, 2] = PercentCFP.ToString();<br \/><\/span><br \/><span style=\"font-family:courier new;\">        arrData[3, 2] = PercentFFS.ToString();<br \/><\/span><\/p>\n<p>    \/*Now, we need to convert this data into XML. We convert using<br \/>   string concatenation.*\/<\/p>\n<p>    <span style=\"font-family:courier new;\">string strXML = &#8220;&#8221;;<br \/><\/span><graph><graph bgalpha=\"0,0\" pieradius=\"50\" showvalues=\"1\" numbersuffix=\"%25\" caption=\"\" numberprefix=\"\" formatnumberscale=\"0\" decimalprecision=\"1\"><\/p>\n<p>    \/*Convert data to XML and append*\/  <br \/>   <span style=\"font-family:courier new;\">for(int pieI = 0; pieI <= arrData.Length - 1; pieI++) <\/span><br \/><span style=\"font-family:courier new;\">{ strXML = strXML &amp;  &#8220;<\/span><set name=\"&quot; + arrData[pieI, 1]  + &quot;\" value=\"&quot; + arrData[pieI, 2] + &quot;\" style=\"\"><span style=\"font-family:courier new;\">&#8220;;  }<\/span><\/p>\n<p><\/set><\/graph><\/graph><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this example, I am using a two-dimensional array to provide attributes for a graph from Fusion Charts : \/*Store sales data*\/ string[,] arrData = new string[4, 2]; arrData[0, 1] = &#8220;Annual Cash Compensation&#8221;; arrData[1, 1] = &#8220;Annual LTI Compensation&#8221;; arrData[2, 1] = &#8220;Current Financial Protection&#8221;; arrData[3, 1] = &#8220;Future Financial Security&#8221;; \/*Store sales amounts*\/ &hellip; <a href=\"https:\/\/www.chrystalsander.com\/blog\/?p=118\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Create Graph Data Using A Two-Dimensional Array&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118"}],"collection":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":0,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}