Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: chart Arguments: data Description: A render function that displays a chart of data (in progress) Page type: webl Render function: chartRender Module: global Page source: // data is a WebL object containing the following fields // categories: a list of categories // series: a list of values for each of the categories // series2: a second list of values for each of the categories // series3: a third list of values for each of the categories // series4: a fourth list of values for each of the categories // type: a string: one of BAR, BAR3D, BARSTK, BARSTK100, column, column3d, // ColumnSTK, ColumnSTK100, LINE, LINESMTH, AREA, AREASTK, AREASKT100, // PIE, PIEEXPL, PIE3D, PIE3DEXPL, columnline, barlinesmth, CONE, CYLINDER // title: a string title for the entire chart // stitle: a string title for the series // stitle2: a string title for series 2 // width: a width in pixels for the chart // height: a height in pixels for the chart // legend: a string: one of "left", "right", or "none" // // To Do: the component supports multiple series, opacities, other colors, etc. // See http://www.gxchart.com/app/hconfigchart.aspx? for all options // If not called from a programmatic function, then set some demo data if Type(data) != "object" then // Sample data data = [. title="Demo Data", type="LINE", legend = "right", series=[100, 2, 30, 50, 90], series2=[10, 20, 35, 45, 70], stitle= "MIN", stitle2="MAX", categories=["adam", "john", "bill", "jim", "fred"] .]; end; var ulist = fun(list) var res = ""; every e in list do if res != "" then res = res + "," end; res = res + ToString(e); end; res end; var title = (data.title ? ""); var stitle = ((data.stitle + ":") ? ""); var stitle2 = ((data.stitle2 + ":") ? ""); var stitle3 = ((data.stitle3 + ":") ? ""); var stitle4 = ((data.stitle4 + ":") ? ""); var type = (data.type ? "Bar"); var height = (ToString(data.height) ? "400"); var width = (ToString(data.width) ? "600"); var legend = (data.legend ? "none"); var categoryorder = (data.categoryorder ? ""); var url = "http://www.gxchart.com/service/drawchart.aspx?"; var params = "Type=" + type + "&title=" + Url_Encode(title) + "&Width=" + width + "&Height=" + height + "&Legend=" + legend; if categoryorder != "" then params = params + "&CategoryOrder=Reverse" end; url = url + "Categories=Values:" + ulist(data.categories ? []) + "&"; url = url + "Series1=Values:" + stitle + ulist(data.series ? []) + "&"; if (stitle2 != "") then url = url + "Series2=Values:" + stitle2 + ulist(data.series2 ? []) + "&"; end; if (stitle3 != "") then url = url + "Series3=Values:" + stitle3 + ulist(data.series3 ? []) + "&"; end; if (stitle4 != "") then url = url + "Series4=Values:" + stitle4 + ulist(data.series4 ? []) + "&"; end; url = url + params;