Skip to content
Moritz Lutz edited this page Dec 6, 2020 · 4 revisions

Import chart

We introduced the possibility to import charts to other pages, this introduced the need to combine all our code to a single file this can be done with the following script ( i don't want to add this to the github page because it gets directly live with it so anyone can catch the script and maybe modify it and do wired things with it)

#!/bin/sh

cat js/internal/helper/Converter.js > js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js
cat js/internal/helper/Constants.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/internal/chart/Chart.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/internal/chart/helper/ColorHelper.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js
cat js/internal/chart/helper/DataHelper.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js
cat js/internal/chart/helper/WowheadHelper.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/internal/chart/definitions/Definitions.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/internal/csv/Csv.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/yaml/yaml.min.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

cat js/internal/helper/ChartImportBasic.js >> js/chart_import.js
sed -i -e '$a\' js/chart_import.js
sed -i -e '$a\' js/chart_import.js

How to import charts to another page:

First of the other page need to include the following scripts:

<script src="https://wow.zamimg.com/widgets/power.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://raw.githubusercontent.com/WarcraftPriests/WarcraftPriests.github.io/master/js/chart_import.js"></script>

And then the following "code" block needs to be added :

<div id="test" 
	class="wcp_chart" 
	data-talent="hv"
	data-sims="talents"
	data-covenants="venthyr"
	data-fightStyle="Composite"
	data-maxentries="10">
</div>

The class needs to be wcp_chart because thats the identifier we look for in the code to include the chart at that point. If you have multiple charts the id of the div needs to be different because hightchart uses this to render the chart to.

Clone this wiki locally