From Dark and Darker Wiki

No edit summary
m (Support xAxisTitle and yAxisTitle params)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:


<script>
<script>
 
   var data = JSON.parse('<!--{$data|escape:'quotes'}-->');
   var data = JSON.parse('<!--{$data|escape:'quotes'}-->')
   var color = '<!--{$color|escape:'quotes'}-->';
   var color = '<!--{$color|escape:'quotes'}-->';
  var backgroundColor = '<!--{$backgroundColor|escape:'quotes'}-->';
   var gridColor = '<!--{$gridColor|escape:'quotes'}-->';
   var gridColor = '<!--{$gridColor|escape:'quotes'}-->';
   var axisColor = '<!--{$axisColor|escape:'quotes'}-->';
   var axisColor = '<!--{$axisColor|escape:'quotes'}-->';
   var fontColor = '<!--{$fontColor|escape:'quotes'}-->';
   var fontColor = '<!--{$fontColor|escape:'quotes'}-->';
  var xAxisTitle = '<!--{$xAxisTitle|escape:'quotes'}-->';
  var yAxisTitle = '<!--{$yAxisTitle|escape:'quotes'}-->';
    
    
   if (color == "") {
   if (color == "") {
Line 42: Line 42:
   var range = [...Array(max - min + 1).keys()].map((x) => x + min);
   var range = [...Array(max - min + 1).keys()].map((x) => x + min);
    
    
   new Chart(document.getElementById('<!--{$id|escape:'html'}-->'), {
   new Chart(document.getElementById('<!--{$uniqueId|escape:'html'}-->'), {
     type: "line",
     type: "line",
     axisX: {
     axisX: {
Line 66: Line 66:
       scales: {
       scales: {
         y: {
         y: {
          title: {
            display: yAxisTitle !== "",
            text: yAxisTitle,
            color: fontColor
          },
           grid: {
           grid: {
             color: gridColor
             color: gridColor
Line 78: Line 83:
         x: {
         x: {
           type: 'linear',
           type: 'linear',
          title: {
            display: xAxisTitle !== "",
            text: xAxisTitle,
            color: fontColor
          },
           grid: {
           grid: {
             color: gridColor
             color: gridColor
Line 91: Line 101:
     }
     }
   });
   });
 
  document.getElementById('<!--{$id|escape:'html'}-->').style.backgroundColor = backgroundColor;
    
    
    
    
</script>
</script>
</includeonly>
</includeonly>

Latest revision as of 15:36, 18 July 2026