Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in electron ReferenceError: RadialGauge is not defined #176

Closed
TuShen121 opened this issue Sep 23, 2018 · 1 comment
Closed

in electron ReferenceError: RadialGauge is not defined #176

TuShen121 opened this issue Sep 23, 2018 · 1 comment

Comments

@TuShen121
Copy link

first thank you for canvas-gauges,
I am sorry ,I am a Chinese student,My English is poor,
I have a problem that cannot be solved. I hope to get your help,
I used electron with canvas-gauges throw error,
"Uncaught ReferenceError: RadialGauge is not defined" and"Uncaught TypeError: Cannot set property 'value' of undefined"
Same code in Chrome ___success
but in electron error
The following code

I'll be glad to hear from you
/***************************************************************************************/
<!doctype html>

<title>Canvas Gauges Async Scripting</title> set100 set0
	<script src="gauge.min.js" type="text/javascript" charset="utf-8"></script>

	<script type="text/javascript">
		new RadialGauge({
			renderTo: 'gauge1',
			width: 300,
			height: 300,
			units: 'Km/h',
			title: false,
			value: 0,
			minValue: 0,
			maxValue: 220,
			majorTicks: [
				'0', '20', '40', '60', '80', '100', '120', '140', '160', '180', '200', '220'
			],
			minorTicks: 2,
			strokeTicks: false,
			highlights: [{
					from: 0,
					to: 50,
					color: 'rgba(0,255,0,.15)'
				},
				{
					from: 50,
					to: 100,
					color: 'rgba(255,255,0,.15)'
				},
				{
					from: 100,
					to: 150,
					color: 'rgba(255,30,0,.25)'
				},
				{
					from: 150,
					to: 200,
					color: 'rgba(255,0,225,.25)'
				},
				{
					from: 200,
					to: 220,
					color: 'rgba(0,0,255,.25)'
				}
			],
			colorPlate: '#222',
			colorMajorTicks: '#f5f5f5',
			colorMinorTicks: '#ddd',
			colorTitle: '#fff',
			colorUnits: '#ccc',
			colorNumbers: '#eee',
			colorNeedle: 'rgba(240, 128, 128, 1)',
			colorNeedleEnd: 'rgba(255, 160, 122, .9)',
			valueBox: true,
			animationRule: 'bounce',
			animationDuration: 500
		}).draw();
		
		function set100(){
			document.gauges[0].value = 100;
		}
		function set0(){
			document.gauges[0].value = 0;
		}
	</script>
</body>
/*************************************************************************************************************/
@TuShen121
Copy link
Author

After a night of hard work,
At the end of the “gauge.min.js”
change
//
("undefined" != typeof module ? module.exports : window);
/
/
into
/***********************************/
( window);
/
******************************/

this module is very good,thanks

@Mikhus Mikhus closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants