| ||
Introducing SharpPlot Your First Chart Recent Updates Sample Charts Tutorials General Tutorials Chart Tutorials SharpPlot Class Properties Structures Enumerations Style examples Glossaries Active Charts VectorMath Class DBUtil Class Get SharpPlot Download SharpPlot Buying SharpPlot SharpPlot Support Upgrading from GraPL Release notes |
Reference > Methods > RenderJsonChartMap SharpPlot.RenderJsonChartMapReturn a JSON-formatted array to facilitate active graphics applications. public string RenderJsonChartMap(); Examplestring map = sp.RenderJsonChartMap(); DescriptionAll data items processed by the chart construction create hotspots which may react to mouse events. There are 3 types of hotspot recorded, depending on the chart type:
If AddAttibutes has been used to put handlers on text items, hotspots will be created for these. Otherwise there will be on hotspot for each data item, keyed by chart name and series name. A typical array would contain several of these, for example a barchart with 2 data series (each with 3 bars) would generate a section of the array like this: ["Apparel","Hats","rect",[84,249,123,362],[["title","Hat 3"]], ["Apparel","Hats","rect",[249,174,288,362],[["title","Hat 5"]], ["Apparel","Hats","rect",[413,99,452,362],[["title","Hat 7"]], ["Apparel","Coats","rect",[147,61,186,362],[["title","Coat 8"]], ["Apparel","Coats","rect",[311,174,350,362],[["title","Coat 5"]], ["Apparel","Coats","rect",[476,212,515,362],[["title","Coat 4"]], Here we have named both the chart “Apparel”” and each series to make the example clearer. By default, SharpPlot will generate names “chart1” and ‘Series1,Series2” for you. The format of each hotspot is standard, and consists of:
If we add some attributes to the chart legend, the map will contain lines like this: ["Guesses","Key","rect",[59,392,157,407],[["KeyFactor","100"],["KeyStyle","Low"]], ["Guesses","Key","rect",[161,392,261,407],[["KeyFactor","200"],["KeyStyle","Medium"]], ["Guesses","Key","rect",[266,392,374,407],[["KeyFactor","300"],["KeyStyle","High"]], Here the second element is the value from the HotspotType enumeration, rather than a series identifier. The entire array will be enclosed with an opening ‘[’ and a closing ‘];’ to allow the programmer to recover the content with a simple eval statement and then to add appropriate behaviours when the mouse is within any of the defined regions. See also ...SharpPlot Members | HotspotType Enumeration | PageMap Class – Introduction |