HIghCharts GAUGE
Marco_Barradas
Altair Employee
Hi I'm trying to use a Highchart Gauge, since it's not part of the standar deployment I create a process that writes the HTML.
Unfortunately it's not working.
I tried the same approach with a google gauge an it worked.
Can you help me?
Unfortunately it's not working.
I tried the same approach with a google gauge an it worked.
Can you help me?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.4.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="text:create_document" compatibility="6.4.001" expanded="true" height="60" name="Create Document" width="90" x="514" y="30">
<parameter key="text" value="<html> <head> <script src="https://myurl:8443/RA/static/javascript/jquery/plugins/jquery.desaturate.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts-more.js"></script> <script src="http://code.highcharts.com/modules/solid-gauge.js"></script> 	<script> $(function () { var gaugeOptions = { chart: { type: 'solidgauge' }, title: null, pane: { center: ['50%', '85%'], size: '140%', startAngle: -90, endAngle: 90, background: { backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE', innerRadius: '60%', outerRadius: '100%', shape: 'arc' } }, tooltip: { enabled: false }, // the value axis yAxis: { stops: [ [0.1, '#55BF3B'], // green [0.5, '#DDDF0D'], // yellow [0.9, '#DF5353'] // red ], lineWidth: 0, minorTickInterval: null, tickPixelInterval: 400, tickWidth: 0, title: { y: -70 }, labels: { y: 16 } }, plotOptions: { solidgauge: { dataLabels: { y: 5, borderWidth: 0, useHTML: true } } } }; // The speed gauge $('#container-speed').highcharts(Highcharts.merge(gaugeOptions, { yAxis: { min: 0, max: 100, title: { text: 'Objetivo' } }, credits: { enabled: false }, series: [{ name: 'Speed', data: [80], dataLabels: { format: '<div style="text-align:center"><span style="font-size:25px;color:' + ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>' + '<span style="font-size:12px;color:silver">km/h</span></div>' }, tooltip: { valueSuffix: ' km/h' } }] })); }); </script> </head> <body> <div style="width: 600px; height: 400px; margin: 0 auto"> 	<div id="container-speed" style="width: 300px; height: 200px; float: left"></div> 	<div id="container-rpm" style="width: 300px; height: 200px; float: left"></div> 	</div> </body> </html>"/>
</operator>
<connect from_op="Create Document" from_port="output" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
0
Answers
-
Hi,
you are missing JQuery. Add this to the scripts:
Regards,
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
Marco0 -
I'm under Server 2.4 tried your suggestion and recieve a blank page.
I believe maybe I'm calling twice the highcharts library, Is there a way to call the library that RapidMiner Server has locally?
My other theory it has something related to https, my server is configured using a certificate.
Thanks.0 -
Hi,
Note that the order of script imports is important - it won't work in the wrong order. This order works for me:
If you want to use the shipped versions (gauge is not part of the shipped version), you can use these imports:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://www.mlganalitica.mx:8443/RA/static/javascript/jquery/plugins/jquery.desaturate.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>
Note that your document has to be in an iframe to prevent it from having access to the (very outdated) JQuery version which is part of the regular Server web pages.
<script src="/static/javascript/html5/highcharts/jquery-1.8.2.min.js"></script>
<script src="/static/javascript/html5/highcharts/highcharts.js"></script>
<script src="/static/javascript/html5/highcharts/highcharts-more.js"></script>
<script src="/static/javascript/html5/highcharts/modules/exporting.js"></script>
<script src="/static/javascript/html5/highcharts/modules/no-data-to-display.js"></script>
Regards,
Marco0 -
Thanks the answer helped a lot, now I can use the Gauge.
Could you please edit the url of my server on your response? =D
Best Regards.0