Difference between revisions of "Template:Echart/doc"

From Moegirlpedia
Jump to: navigation, search
(Created page with "This template is used to display charts rendered using [https://echarts.apache.org/en/index.html Apache Echarts 4], using the following 5 parameters: * '''datapage''': '''{{c...")
 
(Changing category)
 
Line 17: Line 17:
 
{{Echart|datapage=User:AnnAngela/contributions|height=370}}
 
{{Echart|datapage=User:AnnAngela/contributions|height=370}}
  
<includeonly>[[Category:Functional templates]][[zh:模板:Echart]]</includeonly>
+
<includeonly>[[Category:Function templates]][[zh:模板:Echart]]</includeonly>
 
<noinclude>[[Category:Template documentation]]</noinclude>
 
<noinclude>[[Category:Template documentation]]</noinclude>

Latest revision as of 22:50, 6 October 2023

This template is used to display charts rendered using Apache Echarts 4, using the following 5 parameters:

  • datapage: Required, specifies the page that contains the data acceptable to Echarts#setOption, and the page must be filled in in JSON format (you can open the page information page at [Page Information] in the toolbar on the left side of the page, and find the page that modifies the "Page Content Type" link; or directly open [[Special:ChangeContentModel/(page name)]]; for example User:AnnAngela/contributions);
  • width: Optional, specifies the width of the chart. Only integers (in px) are supported. If the value cannot be parsed as an integer or less than or equal to 160, it will be parsed as 1200;
  • height: Optional, specifies the height of the chart. Only integers (in px) are supported. If the value cannot be parsed as an integer or is less than or equal to 90, it will be parsed as 675;
  • debug: Optional, when the value is 1, specify the page to load the debug version (that is, the version that has not been compressed by Uglifyjs, this version will output complete error information, which is suitable for debugging; this setting is global, as long as there is one place in the page If debug=1 is specified, the page will only load the debug version).
  • draw: Optional. {{Echart}} can draw multiple data series at the same time, but if you need to call this template multiple times in a page for layout considerations, you need to add draw=off every time except the last call.

Note: Due to security reasons, the data loaded by this template does not accept html strings. If necessary, please use richText. (i.e. the html string will be formatted and not loaded to avoid XSS errors like in this example)


The following is an example:

{{Echart|datapage=User:AnnAngela/contributions|height=370}}
Error in widget Echart: Unable to load template wiki 'Echart'