Template:Echart

From Moegirlpedia
Revision as of 14:54, 21 March 2022 by LiaMinina (talk | contribs) (Created page with "<includeonly>{{#if:{{{datapage|}}}|<div class="echart-app" data-debug="{{#ifeq:{{{debug|}}}|1|true|false}}" data-width={{#if:{{{width|}}}|{{{width|}}}|1200}}" data-height={{#i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Template-info.svg Template Documentation  [View] [Edit] [History] [Refresh]

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'