If I move the value of b in the below example in a german browser (with default locale DE) the output of the corresponding value will be printed with a ,
(comma) instead of a .
(dot). For example "1,7".
>> mathcell.js:307:23
Unexpected value NaN parsing attribute y.
If I set the value manually to "1.7" (with a dot) the examples works without problems.
Is there a setting, so that the value for the slider is always printed with locale "us" defaults?
<html>
<head>
<meta charset="utf-8">
<title>MathCell</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/mathcell.js"></script>
<p style="text-align: center; line-height: 2"><span style="font-size: 20pt">MathCell</span></p>
<div class="mathcell" style="height: 4in">
<script>
var parent = document.scripts[ document.scripts.length - 1 ].parentNode;
var id = generateId();
parent.id = id;
MathCell( id, [ { type: 'slider', min: 1, max: 3, name: 'a', label: 'a' }
, { type: 'slider', min: 1, max: 3, name: 'b', label: 'b' }
] );
parent.update = function( id ) {
var a = document.getElementById( id + 'a' ).value;
var b = document.getElementById( id + 'b' ).value;
function z1(x) { return Math.sin(a*x+b); }
function z2(x) { return Math.cos(a*x+b); }
var p1 = plot( z1, [-3*Math.PI, 3*Math.PI], { } );
var p2 = plot( z2, [-3*Math.PI, 3*Math.PI], { } );
var config = { type: 'svg' };
var data = [ p1, p2 ];
evaluate( id, data, config );
}
parent.update( id );
</script>
</div>
</body>
</html>