<commit_before><?php

/**
 * @file
 * Contains \Drupal\dashpage\Controller\DashpageJsonGenerator.
 */

namespace Drupal\dashpage\Content;

use Drupal\Core\Controller\ControllerBase;

/**
 *
 $JsonDashpageBase = new JsonDashpageBase();
 $JsonDashpageBase->getCommonTable();
 */
class JsonDashpageBase {
  private $post_url = NULL;

  public function getPostUrl() {
    return $this->post_url;
  }

  public function setPostUrl($value = NULL) {
    $this->post_url = $value;
  }

  /** - - - - - field- - - - - - - - - - - - - - - */
  /**
   *
   */
  public function getTileStyleOne($option = array(), $value = NULL, $value_one = NULL) {
    $output = array(
      'blockId' => 1,
      'class' => "col-md-3 col-xs-6",
      'type' => "widgetOne",
      'value' => array(
        'header' => array(
          'class' => "color-fff",
          'value' => array(
            'class' => "font-size-14",
            'value' => $value,
          ),
          'valueOne' => array(
            'class' => "font-size-12",
            'value' => $value_one,
          ),
        ),
      ),
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockOne($option = array(), $middle_middle_value = array()) {
    $output = array(
      'blockId' => 25,
      'class' => "col-md-6",
      'blockClasses' => '',
      'type' => "chart",   // chart or multiContiner
      'top' =>  array(
        'enable' => true,
        'value' => NULL,   // Block Top text
      ),
      'middle' =>  array(
        'enable' => true,
        'middleTop' => NULL,    // Block Middle Top HTML text
        'middleMiddle' =>  array(
          'middleMiddleLeftClass' => "",
          'middleMiddleLeft' => "",
          'middleMiddleMiddleClass' => "",
          'middleMiddleMiddle' => $middle_middle_value,
          'middleMiddleRightClass' => "",
          'middleMiddleRight' => ""
        ),
        'middleBottom' => NULL   // Block Middle Bottom HTML text
      ),
      'bottom' => array(
        'enable' => true,
        'value' => NULL              // Block Bottom text
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockTabContainer($option = array(), $middle_middle = NULL) {
    $output = array(
      'blockId' => 67,
      'class' => "col-md-6",
      'blockClasses' => 'col-md-6',
      'title' => "Tab 1",
      'type' => "chart",
      'top' =>  array(
        'enable' => true,
        'value' => "Working Diagnosis TabContainer"
      ),
      'middle' =>  array(
        'enable' => true,
        'middleTop' => "<div>Doughnut-Chart-Middle-Top</div>",
        'middleMiddle' =>  array(
          'middleMiddleLeftClass' => "",
          'middleMiddleLeft' => "",
          'middleMiddleMiddleClass' => "col-sm-10",
          'middleMiddleMiddle' => $middle_middle,
          'middleMiddleRightClass' => "",
          'middleMiddleRight' => ""
        ),
        'middleBottom' => "<div>Doughnut-Chart-Middle-Bottom</div>"
      ),
      'bottom' => array(
        'enable' => true,
        'value' => "<div>Doughnut-Chart-Bottom</div>"
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockMultiTabs($option = array(), $tabs_value = array()) {
    $output = array(
      "blockId" => 67,
      "class" => "col-md-12",
      "type" => "multiTabs",
      "blockClasses" => "",
      "top" => array(
        "enable" => true,
        "value" => "Multi Tabs"
      ),
      "middle" => array(
        "enable" => true,
        "value" => $tabs_value,
      ),
      "bottom" => array(
        "enable" => true,
        "value" => "<div>Multi Tabs Bottom</div>"
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  public function chartNewJsOptions() {
    $output = array(
      "animation" => true,
      'animationSteps'=> 50,
      "annotateClassName" => "my11001799tooltip",
      "annotateDisplay" => true, //onhover value
      "annotateLabel" => "<%=v3%>",
      "datasetFill" => false,
      "datasetStrokeWidth" => 2,
      "inGraphDataBordersXSpace" => 12,
      "inGraphDataBordersYSpace" => 7,
      "inGraphDataFontColor" => "#163c52",
      "inGraphDataFontSize" => 12,
      "inGraphDataFontStyle" => "normal normal",
      "inGraphDataPaddingY" => 15,
      "inGraphDataShow" => true,
      "inGraphDataTmpl" => "<%=v3%>",
      "maxLegendCols" => 5, //maximum legend columns
      "responsive" => true,
      "responsiveMaxHeight" => 357,
      "responsiveMinHeight" => 280,
      "spaceBottom" => 10,
      "spaceTop" => 10,
      "legend" => false
      // "legendBlockSize" => 14,
      // "legendBorders" => false,
      // "legendFontColor" => "#000",
      // "legendFontFamily" => "Roboto,'Helvetica Neue',sans-serif",
      // "legendPosX" => 2,
      // "legendPosY" => 0,
      // "legendSpaceAfterText" => 0,
      // "legendSpaceBeforeText" => 10,
      // "legendSpaceBetweenBoxAndText" => 9,
      // "legendSpaceBetweenTextHorizontal" => 159999,
      // "legendSpaceBetweenTextVertical" => 28,
      // "legendSpaceLeftText" => 18,
    );

    return $output;
  }

  /**
   *
   */
  public function getChartBar($option = array()) {
    $output = array(
      "chartId" => hexdec(substr(uniqid(), 0, 13)),
      "chartType" => "Bar",
      "chartClass" => "col-md-4",  // only render on getBlockMultiContainer
      "chartTitle" => "Identify and address only render on getBlockMultiContainer",
      "chartData" => array(
        "labels" => [
          "ADP-1000",
          "Ellipse-1000D",
          "LU2000"
        ],
        "datasets" => [
          array(
            "fillColor" => "#2FA9E0",
            "strokeColor" => "#ffffff",
            "pointColor" => "#05d23e",
            "pointStrokeColor" => "#fff",
            "data" => [
              20,
              14,
              12
            ],
            "title" => "Working Dx"
          ),
          array(
            "fillColor" => "#f24b99",
            "strokeColor" => "#ffffff",
            "pointColor" => "#05d23e",
            "pointStrokeColor" => "#fff",
            "data" => [
              22,
              15,
              19
            ],
            "title" => ""
          )
        ]
      ),
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["barBorderRadius"]  = 5;
    $output["chartOptions"]["barStrokeWidth"]  = 10;
    $output["chartOptions"]["barValueSpacing"]  = 10;
    $output["chartOptions"]["graphMax"] = 100;
    $output["chartOptions"]["graphMin"] = 0;
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["scaleFontSize"] = 14;
    $output["chartOptions"]["yAxisMinimumInterval"] = 10;
    $output["chartOptions"]["yScaleLabelsMinimumWidth"]  = 40;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getChartDoughnut($option = array()) {
    $output = array(
      'chartId' => hexdec(substr(uniqid(), 0, 13)),
      'chartType' => "Doughnut",
      'chartData' => [
        array(
          'value' => 5,
          'color' => "#f3f3f3",
          'title' => "Yes"
        ),
        array(
          'value' => 65,
          'color' => "#1aaadb",
          'title' => "No"
        )
      ],
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["annotateDisplay"] = false;
    $output["chartOptions"]["barValueSpacing"] = 20;
    $output["chartOptions"]["bezierCurveTension"] = 0.1;
    $output["chartOptions"]["crossText"] = ["", "收款", "82%"];
    $output["chartOptions"]["crossTextAlign"] = ["center"];
    $output["chartOptions"]["crossTextBaseline"] = ["middle"];
    $output["chartOptions"]["crossTextFontColor"] = ["black"];
    $output["chartOptions"]["crossTextFontSize"] = [0,30,30];
    $output["chartOptions"]["crossTextIter"] = ["last"];
    $output["chartOptions"]["crossTextOverlay"] = [true];
    $output["chartOptions"]["crossTextPosX"] = [0,0,0];
    $output["chartOptions"]["crossTextPosY"] = [0,20,-30];
    $output["chartOptions"]["crossTextRelativePosX"] = [0,2,2];
    $output["chartOptions"]["crossTextRelativePosY"] = [0,2,2];
    $output["chartOptions"]["inGraphDataShow"] = false;
    $output["chartOptions"]["percentageInnerCutout"] = 90;
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["yAxisMinimumInterval"] = 20;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getChartPie($option = array()) {
    $output = array(
      "chartId" => hexdec(substr(uniqid(), 0, 13)),
      "chartType" => "Pie",
      "chartClass" => "col-md-6 opacity-05",  // only render on getBlockMultiContainer
      "chartTitle" => "Identify and address only render on getBlockMultiContainer",
      "chartData" => [
        array(
          "value" => 12,
          "color" => "#2fa9e0",
          "title" => "1(12)"
        ),
        array(
          "value" => 28,
          "color" => "#f24b99",
          "title" => "2(28)"
        ),
        array(
          "value" => 9,
          "color" => "#37d8b3",
          "title" => "3(9)"
        ),
        array(
          "value" => 5,
          "color" => "#bfbfbf",
          "title" => "4(5)"
        )
      ],
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["barValueSpacing"] = 0;
    $output["chartOptions"]["barValueSpacing"] = 0;
    $output["chartOptions"]["bezierCurveTension"] = 0.1;
    $output["chartOptions"]["inGraphDataAlign"] = "center";
    $output["chartOptions"]["inGraphDataAnglePosition"] = 2;
    $output["chartOptions"]["inGraphDataFontColor"] = "#ffffff";
    $output["chartOptions"]["inGraphDataPaddingRadius"] = 25;
    $output["chartOptions"]["inGraphDataRadiusPosition"] = 2;
    $output["chartOptions"]["inGraphDataTmpl"] = "<%=(Math.round(v6))+'%'%>";
    $output["chartOptions"]["percentageInnerCutout"] = 99; //inner cut area
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["title"] = "";
    $output["chartOptions"]["yAxisMinimumInterval"] = 20;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getCommonTable($option = array(), $value = NULL) {
    if (!$value) {
      $value = array(
        "thead" => [
          [
            "Speciality",
            "Number",
            "Percentage"
          ]
        ],
        "tbody" => [
          [
            "Family Physician",
            818800,
            "55%"
          ],
          [
            "Pharmacist",
            15,
            "10%"
          ],
          [
            "Nurse",
            15,
            "10%"
          ],
          [
            "Diabetes Nurse Educator",
            7,
            "5%"
          ],
          [
            "Other",
            7,
            "5%"
          ],
          [
            "Dietitian",
            6,
            "4%"
          ],
          [
            "Nurse Practitioner",
            6,
            "4%"
          ],
          [
            "Resident",
            3,
            "2%"
          ],
          [
            "Internist",
            3,
            "2%"
          ],
          [
            "Endocrinologist",
            2,
            "1%"
          ],
          [
            "Anesthesiologists",
            1,
            "1%"
          ]
        ]
      );
    }

    $output = array(
      "class" => "font-size-12",
      "tableSettings" => array(
        "pagination" => true,
        "searchFilter" => true,
        "paginationType" => "full_numbers",
        "searchPlaceholder" => "SEARCH"
      ),
      "value" => $value,
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function setBlockProperty($output = array(), $option = array()) {
    if (is_array($option)) {
      foreach ($option as $key => $value) {
        if (isset($output[$key])) {
          if (is_array($value)) {
            $output[$key] = $this->setBlockProperty($output[$key], $value);
          }
          else {
            $output[$key] = $value;
          }<commit_msg>update DashpageJsonGenerator.php<commit_after><?php

/**
 * @file
 * Contains \Drupal\dashpage\Controller\DashpageJsonGenerator.
 */

namespace Drupal\dashpage\Content;

use Drupal\Core\Controller\ControllerBase;

/**
 *
 $JsonDashpageBase = new JsonDashpageBase();
 $JsonDashpageBase->getCommonTable();
 */
class JsonDashpageBase {
  private $post_url = NULL;

  public function getPostUrl() {
    return $this->post_url;
  }

  public function setPostUrl($value = NULL) {
    $this->post_url = $value;
  }

  /** - - - - - field- - - - - - - - - - - - - - - */
  /**
   *
   */
  public function getTileStyleOne($option = array(), $value = NULL, $value_one = NULL) {
    $output = array(
      'blockId' => 1,
      'class' => "col-md-3 col-xs-6",
      'type'  => "widgetOne",
      'value' => array(
        'header' => array(
          'class' => "color-fff",
          'value' => array(
            'class' => "font-size-14",
            'value' => $value,
          ),
          'valueOne' => array(
            'class' => "font-size-12",
            'value' => $value_one,
          ),
        ),
      ),
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockOne($option = array(), $middle_middle_value = array()) {
    $output = array(
      'blockId' => uniqid(),
      'class' => "col-md-12",
      'blockClasses' => '',
      'type' => "chart",          // chart or multiContiner, commonTable, googleMap
      'top'  =>  array(
        'enable' => true,
        'value' => NULL,          // block top title value
      ),
      'middle' =>  array(
        'enable' => true,
        'middleTop' => NULL,      // block middleTop HTML value, "<div>Multi-Chart-Middle-Top</div>"
        'middleMiddle' =>  array(
          'middleMiddleLeftClass' => "",
          'middleMiddleLeft' => "",
          'middleMiddleMiddleClass' => "",
          'middleMiddleMiddle' => $middle_middle_value,
          'middleMiddleRightClass' => "",
          'middleMiddleRight' => ""
        ),
        'middleBottom' => NULL,   // block middleBottom HTML value, "<div>Multi-Chart-Middle-Bottom</div>"
      ),
      'bottom' => array(
        'enable' => true,
        'value' => NULL,          // block Bottom HTML value, "<div>Multi-Chart-Bottom</div>"
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockTabContainer($option = array(), $middle_middle = NULL) {
    $output = array(
      'blockId' => 67,
      'class' => "col-md-12",
      'blockClasses' => 'col-md-6',    // write comments
      'title' => "Tab 1",
      'type' => "chart",
      'top' =>  array(
        'enable' => true,
        'value' => NULL
      ),
      'middle' =>  array(
        'enable' => true,
        'middleTop' => NULL,
        'middleMiddle' =>  array(
          'middleMiddleLeftClass' => "",
          'middleMiddleLeft' => "",
          'middleMiddleMiddleClass' => "col-sm-10",
          'middleMiddleMiddle' => $middle_middle,
          'middleMiddleRightClass' => "",
          'middleMiddleRight' => ""
        ),
        'middleBottom' => NULL
      ),
      'bottom' => array(
        'enable' => true,
        'value' => NULL
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getBlockMultiTabs($option = array(), $tabs_value = array()) {
    $output = array(
      "blockId" => 67,
      "class" => "col-md-12",
      "type" => "multiTabs",
      "blockClasses" => "",
      "top" => array(
        "enable" => true,
        "value" => "Multi Tabs"
      ),
      "middle" => array(
        "enable" => true,
        "value" => $tabs_value,
      ),
      "bottom" => array(
        "enable" => true,
        "value" => "<div>Multi Tabs Bottom</div>"
      )
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function chartNewJsOptions() {
    $output = array(
      "animation" => true,
      'animationSteps'=> 50,
      "annotateClassName" => "my11001799tooltip",
      "annotateDisplay" => true, //onhover value
      "annotateLabel" => "<%=v3%>",
      "datasetFill" => false,
      "datasetStrokeWidth" => 2,
      "inGraphDataBordersXSpace" => 12,
      "inGraphDataBordersYSpace" => 7,
      "inGraphDataFontColor" => "#163c52",
      "inGraphDataFontSize" => 15,
      "inGraphDataFontStyle" => "normal normal",
      "inGraphDataPaddingY" => 15,
      "inGraphDataShow" => true,
      "inGraphDataTmpl" => "<%=v3%>",
      "maxLegendCols" => 5, //maximum legend columns
      "responsive" => true,
      "responsiveMaxHeight" => 357,
      "responsiveMinHeight" => 280,
      "spaceBottom" => 10,
      "spaceTop" => 10,
      "legend" => false,
      "legendBlockSize" => 14,
      "legendBorders" => false,
      "legendFontColor" => "#000",
      "legendFontFamily" => "Roboto,'Helvetica Neue',sans-serif",
      "legendPosX" => 2,
      "legendPosY" => 0,
      "legendSpaceAfterText" => 0,
      "legendSpaceBeforeText" => 10,
      "legendSpaceBetweenBoxAndText" => 9,
      "legendSpaceBetweenTextHorizontal" => 15,
      "legendSpaceBetweenTextVertical" => 28,
      "legendSpaceLeftText" => 18,
      "legendBlockSize" => 14,
    );

    return $output;
  }

  /**
   *
   *
   $chart_data = array(
     "labels" => [
       "IPF",
       "CTLD-ID",
       "Other"
     ],
     "datasets" => [
       array(
         "fillColor" => "#2FA9E0",
         "strokeColor" => "#ffffff",
         "pointColor" => "#05d23e",
         "pointStrokeColor" => "#fff",
         "data" => [
           20,
           14,
           12
         ],
         "title" => "Working Dx"
       ),
       array(
         "fillColor" => "#f24b99",
         "strokeColor" => "#ffffff",
         "pointColor" => "#05d23e",
         "pointStrokeColor" => "#fff",
         "data" => [
           22,
           15,
           19
         ],
         "title" => "Working Dx 666"
       )
     ]
   );
   */

  public function getChartBar($option = array(), $chart_data = array()) {
    $output = array(
      "chartId" => hexdec(substr(uniqid(), 0, 13)),
      "chartType" => "Bar",
      "chartClass" => "col-md-6",  // only render on getBlockMultiContainer
      "chartTitle" => "Identify and address only render on getBlockMultiContainer",         // do we need this one
      "chartData" => $chart_data
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["barBorderRadius"]  = 5;
    $output["chartOptions"]["barStrokeWidth"]  = 10;
    $output["chartOptions"]["barValueSpacing"]  = 10;
    $output["chartOptions"]["graphMax"] = 100;
    $output["chartOptions"]["graphMin"] = 0;
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["scaleFontSize"] = 14;
    $output["chartOptions"]["yAxisMinimumInterval"] = 10;
    $output["chartOptions"]["yScaleLabelsMinimumWidth"]  = 40;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   * @return Array data
   */
  public function getChartLine($option = array(), $chart_data = array()) {
    $output = array(
      "chartId" => hexdec(substr(uniqid(), 0, 13)),
      "chartClass" => "col-md-6 opacity-05",
      "chartType" => "Line",
      "chartTitle" => "Line Chart",
      "chartData" => $chart_data
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["barValueSpacing"] = 20;
    $output["chartOptions"]["bezierCurveTension"] = 0.2;
    $output["chartOptions"]["graphMax"] = 100;
    $output["chartOptions"]["graphMin"] = 0;
    $output["chartOptions"]["inGraphDataShow"] = false;
    $output["chartOptions"]["maxLegendCols"] = 1;
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["percentageInnerCutout"] = 99;
    $output["chartOptions"]["scaleFontSize"] = 14;
    $output["chartOptions"]["legendPosX"] = 4;
    $output["chartOptions"]["legendPosY"] = -2;
    $output["chartOptions"]["legendSpaceLeftText"] = 18;
    $output["chartOptions"]["yAxisLabel"] = "Number of events";
    $output["chartOptions"]["yAxisMinimumInterval"] = 20;
    $output["chartOptions"]["yScaleLabelsMinimumWidth"] = 40;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   *
   *
    $chartData = [
      array(
       'value' => 5,
       'color' => "#f3f3f3",
       'title' => "Yes"
      ),
      array(
       'value' => 65,
       'color' => "#1aaadb",
       'title' => "No"
      )
    ],
   */
  public function getChartDoughnut($option = array(), $chart_data = array()) {
    $output = array(
      'chartId' => hexdec(substr(uniqid(), 0, 13)),
      'chartType' => "Doughnut",
      'chartData' => $chart_data
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["annotateDisplay"] = false;
    $output["chartOptions"]["barValueSpacing"] = 20;
    $output["chartOptions"]["bezierCurveTension"] = 0.1;
    $output["chartOptions"]["crossText"] = ["", "Confirmed", "82%"];
    $output["chartOptions"]["crossTextAlign"] = ["center"];
    $output["chartOptions"]["crossTextBaseline"] = ["middle"];
    $output["chartOptions"]["crossTextFontColor"] = ["black"];
    $output["chartOptions"]["crossTextFontSize"] = [0,30,30];
    $output["chartOptions"]["crossTextIter"] = ["last"];
    $output["chartOptions"]["crossTextOverlay"] = [true];
    $output["chartOptions"]["crossTextPosX"] = [0,0,0];
    $output["chartOptions"]["crossTextPosY"] = [0,20,-30];
    $output["chartOptions"]["crossTextRelativePosX"] = [0,2,2];
    $output["chartOptions"]["crossTextRelativePosY"] = [0,2,2];
    $output["chartOptions"]["inGraphDataShow"] = false;
    $output["chartOptions"]["percentageInnerCutout"] = 90;
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["yAxisMinimumInterval"] = 20;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   * chart_data = array(
      array(
        "value" => 12,
        "color" => "#2fa9e0",
        "title" => "1(12)"
      ),
      array(
        "value" => 28,
        "color" => "#f24b99",
        "title" => "2(28)"
      ),
      array(
        "value" => 9,
        "color" => "#37d8b3",
        "title" => "3(9)"
      ),
      array(
        "value" => 5,
        "color" => "#bfbfbf",
        "title" => "4(5)"
      )
    );
   */
  public function getChartPie($option = array(), $chart_data = array()) {
    $output = array(
      "chartId" => hexdec(substr(uniqid(), 0, 13)),
      "chartType" => "Pie",
      "chartClass" => "col-md-6 opacity-05",  // only render on getBlockMultiContainer
      "chartTitle" => "Identify and address only render on getBlockMultiContainer",
      "chartData" => $chart_data
    );

    $output["chartOptions"] = $this->chartNewJsOptions();
    $output["chartOptions"]["barValueSpacing"] = 0;
    $output["chartOptions"]["barValueSpacing"] = 0;
    $output["chartOptions"]["bezierCurveTension"] = 0.1;
    $output["chartOptions"]["inGraphDataAlign"] = "center";
    $output["chartOptions"]["inGraphDataAnglePosition"] = 2;
    $output["chartOptions"]["inGraphDataFontColor"] = "#ffffff";
    $output["chartOptions"]["inGraphDataPaddingRadius"] = 25;
    $output["chartOptions"]["inGraphDataRadiusPosition"] = 2;
    $output["chartOptions"]["inGraphDataTmpl"] = "<%=(Math.round(v6))+'%'%>";
    $output["chartOptions"]["percentageInnerCutout"] = 99; //inner cut area
    $output["chartOptions"]["pointDotRadius"] = 6;
    $output["chartOptions"]["title"] = "";
    $output["chartOptions"]["yAxisMinimumInterval"] = 20;

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function getCommonTable($option = array(), $value = NULL) {
    if (!$value) {
      $value = array(
        "thead" => [
          [
            "Speciality",
            "Number",
            "Percentage"
          ]
        ],
        "tbody" => [
          [
            "Family Physician",
            818800,
            "55%"
          ],
          [
            "Pharmacist",
            15,
            "10%"
          ],
          [
            "Nurse",
            15,
            "10%"
          ],
          [
            "Diabetes Nurse Educator",
            7,
            "5%"
          ],
          [
            "Other",
            7,
            "5%"
          ],
          [
            "Dietitian",
            6,
            "4%"
          ],
          [
            "Nurse Practitioner",
            6,
            "4%"
          ],
          [
            "Resident",
            3,
            "2%"
          ],
          [
            "Internist",
            3,
            "2%"
          ],
          [
            "Endocrinologist",
            2,
            "1%"
          ],
          [
            "Anesthesiologists",
            1,
            "1%"
          ]
        ]
      );
    }

    $output = array(
      "class" => "font-size-12",
      "tableSettings" => array(
        "pagination" => true,
        "searchFilter" => true,
        "paginationType" => "full_numbers",
        "searchPlaceholder" => "SEARCH"
      ),
      "value" => $value,
    );

    $output = $this->setBlockProperty($output, $option);

    return $output;
  }

  /**
   *
   */
  public function setBlockProperty($output = array(), $option = array()) {
    if (is_array($option)) {
      foreach ($option as $key => $value) {
        if (array_key_exists($key, $output)) {
          if (is_array($value)) {
            $output[$key] = $this->setBlockProperty($output[$key], $value);
          }
          else {
            $output[$key] = $value;
          }
{'fraction_non_alphanumeric': 0.1846241674595623, 'fraction_numerical': 0.02028544243577545, 'mean_word_length': 2.073216374269006, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 377, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3107599', 'n_tokens_mistral': 8718, 'n_tokens_neox': 8361, 'n_words': 1418}