Amcharts chart dont show in DB2

I have in my flow amcharts demo charts code both DB1 and DB2 template nodes.
I cant get showing chart in DB2.
Any help?

DB1

[
    {
        "id": "7cfbf307c75b7796",
        "type": "tab",
        "label": "DB1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "120ce856b7c5535c",
        "type": "ui_template",
        "z": "7cfbf307c75b7796",
        "group": "5c6d2861d8397c48",
        "name": "",
        "order": 1,
        "width": "12",
        "height": "6",
        "format": "<script src=\"https://cdn.amcharts.com/lib/5/index.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/xy.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/plugins/exporting.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/themes/Animated.js\"></script>\n<div id=\"chartdiv\"></div>\n<script>\nvar root = am5.Root.new(\"chartdiv\");\nroot.setThemes([am5themes_Animated.new(root)]);\n\nvar data = [\n  { date: \"2012-01-01\", value: 8 },\n  { date: \"2012-01-02\", value: 10 },\n  { date: \"2012-01-03\", value: 12 },\n  { date: \"2012-01-04\", value: 14 },\n  { date: \"2012-01-05\", value: 11 },\n  { date: \"2012-01-06\", value: 6 },\n  { date: \"2012-01-07\", value: 7 },\n  { date: \"2012-01-08\", value: 9 },\n  { date: \"2012-01-09\", value: 13 },\n  { date: \"2012-01-10\", value: 15 },\n  { date: \"2012-01-11\", value: 19 },\n  { date: \"2012-01-12\", value: 21 },\n  { date: \"2012-01-13\", value: 22 },\n  { date: \"2012-01-14\", value: 20 },\n  { date: \"2012-01-15\", value: 18 },\n  { date: \"2012-01-16\", value: 14 },\n  { date: \"2012-01-17\", value: 16 },\n  { date: \"2012-01-18\", value: 18 },\n  { date: \"2012-01-19\", value: 17 },\n  { date: \"2012-01-20\", value: 15 },\n  { date: \"2012-01-21\", value: 12 },\n  { date: \"2012-01-22\", value: 10 },\n  { date: \"2012-01-23\", value: 8 }\n];\n\nvar chart = root.container.children.push(\n  am5xy.XYChart.new(root, {\n    focusable: true,\n    panX: true,\n    panY: true,\n    wheelX: \"panX\",\n    wheelY: \"zoomX\"\n  })\n);\n\nvar easing = am5.ease.linear;\n\nvar xAxis = chart.xAxes.push(\n  am5xy.DateAxis.new(root, {\n    maxDeviation: 0.1,\n    groupData: false,\n    baseInterval: {\n      timeUnit: \"day\",\n      count: 1\n    },\n    renderer: am5xy.AxisRendererX.new(root, {\n      minGridDistance: 50\n    }),\n    tooltip: am5.Tooltip.new(root, {\n      themeTags: [\"axis\"],\n      animationDuration: 300\n    })\n  })\n);\n\nvar yAxis = chart.yAxes.push(\n  am5xy.ValueAxis.new(root, {\n    maxDeviation: 0.1,\n    renderer: am5xy.AxisRendererY.new(root, {})\n  })\n);\n\nvar series = chart.series.push(\n  am5xy.LineSeries.new(root, {\n    minBulletDistance: 10,\n    xAxis: xAxis,\n    yAxis: yAxis,\n    valueYField: \"value\",\n    valueXField: \"date\"\n  })\n);\n\nseries.data.processor = am5.DataProcessor.new(root, {\n  dateFormat: \"yyyy-MM-dd\",\n  dateFields: [\"date\"]\n});\n\nseries.data.setAll(data);\n\nvar tooltip = am5.Tooltip.new(root, {\n  pointerOrientation: \"horizontal\"\n});\ntooltip.label.set(\"text\", \"{valueY}\");\nseries.set(\"tooltip\", tooltip);\n\nseries.bullets.push(function () {\n  return am5.Bullet.new(root, {\n    sprite: am5.Circle.new(root, {\n      radius: 5,\n      fill: series.get(\"fill\"),\n      stroke: root.interfaceColors.get(\"background\"),\n      strokeWidth: 2\n    })\n  });\n});\n\nvar cursor = chart.set(\n  \"cursor\",\n  am5xy.XYCursor.new(root, {\n    xAxis: xAxis\n  })\n);\ncursor.lineY.set(\"visible\", false);\n\nseries.appear(1000, 100);\nchart.appear(1000, 100);\n\nvar exporting = am5plugins_exporting.Exporting.new(root, {\n  menu: am5plugins_exporting.ExportingMenu.new(root, {})\n});\n\nvar annotator = am5plugins_exporting.Annotator.new(root, {});\n\nvar menuitems = exporting.get(\"menu\").get(\"items\");\n\nmenuitems.push({\n  type: \"separator\"\n});\n\nmenuitems.push({\n  type: \"custom\",\n  label: \"Annotate\",\n  callback: function() {\n    this.close();\n    annotator.toggle();\n  }\n});\n</script>\n<style>\n#chartdiv {\nwidth: 100%;\nheight: 85vh;\n}\n</style>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 460,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "70fda6a3a9651913",
        "type": "comment",
        "z": "7cfbf307c75b7796",
        "name": "Dashboard 1",
        "info": "",
        "x": 470,
        "y": 40,
        "wires": []
    },
    {
        "id": "5c6d2861d8397c48",
        "type": "ui_group",
        "name": "koe",
        "tab": "910b730f79abe6a0",
        "order": 1,
        "disp": false,
        "width": "26",
        "collapse": false,
        "className": ""
    },
    {
        "id": "910b730f79abe6a0",
        "type": "ui_tab",
        "name": "testi",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

DB2

[
    {
        "id": "122e3e07469bfdd0",
        "type": "tab",
        "label": "DB2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "2133592f6cdae9e4",
        "type": "comment",
        "z": "122e3e07469bfdd0",
        "name": "Dashboard 2",
        "info": "",
        "x": 390,
        "y": 80,
        "wires": []
    },
    {
        "id": "e5f9da6312dd4664",
        "type": "ui-template",
        "z": "122e3e07469bfdd0",
        "group": "",
        "page": "a916073c7fc38435",
        "ui": "",
        "name": "",
        "order": 1,
        "width": "12",
        "height": "6",
        "head": "",
        "format": "<script src=\"https://cdn.amcharts.com/lib/5/index.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/xy.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/plugins/exporting.js\"></script>\n<script src=\"https://cdn.amcharts.com/lib/5/themes/Animated.js\"></script>\n<div id=\"chartdiv\"></div>\n<script>\nvar root = am5.Root.new(\"chartdiv\");\nroot.setThemes([am5themes_Animated.new(root)]);\n\nvar data = [\n  { date: \"2012-01-01\", value: 8 },\n  { date: \"2012-01-02\", value: 10 },\n  { date: \"2012-01-03\", value: 12 },\n  { date: \"2012-01-04\", value: 14 },\n  { date: \"2012-01-05\", value: 11 },\n  { date: \"2012-01-06\", value: 6 },\n  { date: \"2012-01-07\", value: 7 },\n  { date: \"2012-01-08\", value: 9 },\n  { date: \"2012-01-09\", value: 13 },\n  { date: \"2012-01-10\", value: 15 },\n  { date: \"2012-01-11\", value: 19 },\n  { date: \"2012-01-12\", value: 21 },\n  { date: \"2012-01-13\", value: 22 },\n  { date: \"2012-01-14\", value: 20 },\n  { date: \"2012-01-15\", value: 18 },\n  { date: \"2012-01-16\", value: 14 },\n  { date: \"2012-01-17\", value: 16 },\n  { date: \"2012-01-18\", value: 18 },\n  { date: \"2012-01-19\", value: 17 },\n  { date: \"2012-01-20\", value: 15 },\n  { date: \"2012-01-21\", value: 12 },\n  { date: \"2012-01-22\", value: 10 },\n  { date: \"2012-01-23\", value: 8 }\n];\n\nvar chart = root.container.children.push(\n  am5xy.XYChart.new(root, {\n    focusable: true,\n    panX: true,\n    panY: true,\n    wheelX: \"panX\",\n    wheelY: \"zoomX\"\n  })\n);\n\nvar easing = am5.ease.linear;\n\nvar xAxis = chart.xAxes.push(\n  am5xy.DateAxis.new(root, {\n    maxDeviation: 0.1,\n    groupData: false,\n    baseInterval: {\n      timeUnit: \"day\",\n      count: 1\n    },\n    renderer: am5xy.AxisRendererX.new(root, {\n      minGridDistance: 50\n    }),\n    tooltip: am5.Tooltip.new(root, {\n      themeTags: [\"axis\"],\n      animationDuration: 300\n    })\n  })\n);\n\nvar yAxis = chart.yAxes.push(\n  am5xy.ValueAxis.new(root, {\n    maxDeviation: 0.1,\n    renderer: am5xy.AxisRendererY.new(root, {})\n  })\n);\n\nvar series = chart.series.push(\n  am5xy.LineSeries.new(root, {\n    minBulletDistance: 10,\n    xAxis: xAxis,\n    yAxis: yAxis,\n    valueYField: \"value\",\n    valueXField: \"date\"\n  })\n);\n\n\nseries.data.processor = am5.DataProcessor.new(root, {\n  dateFormat: \"yyyy-MM-dd\",\n  dateFields: [\"date\"]\n});\n\nseries.data.setAll(data);\n\nvar tooltip = am5.Tooltip.new(root, {\n  pointerOrientation: \"horizontal\"\n});\ntooltip.label.set(\"text\", \"{valueY}\");\nseries.set(\"tooltip\", tooltip);\n\nseries.bullets.push(function () {\n  return am5.Bullet.new(root, {\n    sprite: am5.Circle.new(root, {\n      radius: 5,\n      fill: series.get(\"fill\"),\n      stroke: root.interfaceColors.get(\"background\"),\n      strokeWidth: 2\n    })\n  });\n});\n\n\nvar cursor = chart.set(\n  \"cursor\",\n  am5xy.XYCursor.new(root, {\n    xAxis: xAxis\n  })\n);\ncursor.lineY.set(\"visible\", false);\n\n// Make stuff animate on load\n// https://www.amcharts.com/docs/v5/concepts/animations/\nseries.appear(1000, 100);\nchart.appear(1000, 100);\n\n// Set up export and annotation\nvar exporting = am5plugins_exporting.Exporting.new(root, {\n  menu: am5plugins_exporting.ExportingMenu.new(root, {})\n});\n\nvar annotator = am5plugins_exporting.Annotator.new(root, {});\n\nvar menuitems = exporting.get(\"menu\").get(\"items\");\n\nmenuitems.push({\n  type: \"separator\"\n});\n\nmenuitems.push({\n  type: \"custom\",\n  label: \"Annotate\",\n  callback: function() {\n    this.close();\n    annotator.toggle();\n  }\n});\n</script>\n<style>\n#chartdiv {\nwidth: 100%;\nheight: 85vh;\n}\n</style>\n",
        "storeOutMessages": true,
        "passthru": true,
        "resendOnRefresh": true,
        "templateScope": "widget:page",
        "className": "",
        "x": 380,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "a916073c7fc38435",
        "type": "ui-page",
        "name": "kaavio",
        "ui": "00b764fcfa23ed43",
        "path": "/page1",
        "icon": "home",
        "layout": "grid",
        "theme": "866053e98035ab1d",
        "order": 1,
        "className": "",
        "visible": true,
        "disabled": "false"
    },
    {
        "id": "00b764fcfa23ed43",
        "type": "ui-base",
        "name": "testi",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default",
        "titleBarStyle": "default"
    },
    {
        "id": "866053e98035ab1d",
        "type": "ui-theme",
        "name": "Theme Name",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094ce",
            "bgPage": "#ffffff",
            "groupBg": "#9a9393",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

here is
html code

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>CodePen - Chart with annotator support</title>
  <link rel="stylesheet" href="./style.css">

</head>
<body>
<!-- partial:index.partial.html -->
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
<script src="https://cdn.amcharts.com/lib/5/plugins/exporting.js"></script>
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
<div id="chartdiv"></div>
<!-- partial -->
  <script  src="./script.js"></script>

</body>
</html>

script code

/**
 * ---------------------------------------
 * This demo was created using amCharts 5.
 *
 * For more information visit:
 * https://www.amcharts.com/
 *
 * Documentation is available at:
 * https://www.amcharts.com/docs/v5/
 * ---------------------------------------
 */

// Create root element
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
var root = am5.Root.new("chartdiv");

// Set themes
// https://www.amcharts.com/docs/v5/concepts/themes/
root.setThemes([am5themes_Animated.new(root)]);

var data = [
  { date: "2012-01-01", value: 8 },
  { date: "2012-01-02", value: 10 },
  { date: "2012-01-03", value: 12 },
  { date: "2012-01-04", value: 14 },
  { date: "2012-01-05", value: 11 },
  { date: "2012-01-06", value: 6 },
  { date: "2012-01-07", value: 7 },
  { date: "2012-01-08", value: 9 },
  { date: "2012-01-09", value: 13 },
  { date: "2012-01-10", value: 15 },
  { date: "2012-01-11", value: 19 },
  { date: "2012-01-12", value: 21 },
  { date: "2012-01-13", value: 22 },
  { date: "2012-01-14", value: 20 },
  { date: "2012-01-15", value: 18 },
  { date: "2012-01-16", value: 14 },
  { date: "2012-01-17", value: 16 },
  { date: "2012-01-18", value: 18 },
  { date: "2012-01-19", value: 17 },
  { date: "2012-01-20", value: 15 },
  { date: "2012-01-21", value: 12 },
  { date: "2012-01-22", value: 10 },
  { date: "2012-01-23", value: 8 }
];

// Create chart
// https://www.amcharts.com/docs/v5/charts/xy-chart/
var chart = root.container.children.push(
  am5xy.XYChart.new(root, {
    focusable: true,
    panX: true,
    panY: true,
    wheelX: "panX",
    wheelY: "zoomX"
  })
);

var easing = am5.ease.linear;

// Create axes
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
var xAxis = chart.xAxes.push(
  am5xy.DateAxis.new(root, {
    maxDeviation: 0.1,
    groupData: false,
    baseInterval: {
      timeUnit: "day",
      count: 1
    },
    renderer: am5xy.AxisRendererX.new(root, {
      minGridDistance: 50
    }),
    tooltip: am5.Tooltip.new(root, {
      themeTags: ["axis"],
      animationDuration: 300
    })
  })
);

var yAxis = chart.yAxes.push(
  am5xy.ValueAxis.new(root, {
    maxDeviation: 0.1,
    renderer: am5xy.AxisRendererY.new(root, {})
  })
);

// Add series
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
var series = chart.series.push(
  am5xy.LineSeries.new(root, {
    minBulletDistance: 10,
    xAxis: xAxis,
    yAxis: yAxis,
    valueYField: "value",
    valueXField: "date"
  })
);

// Set up data processor to parse string dates
// https://www.amcharts.com/docs/v5/concepts/data/#Pre_processing_data
series.data.processor = am5.DataProcessor.new(root, {
  dateFormat: "yyyy-MM-dd",
  dateFields: ["date"]
});

series.data.setAll(data);

var tooltip = am5.Tooltip.new(root, {
  pointerOrientation: "horizontal"
});
tooltip.label.set("text", "{valueY}");
series.set("tooltip", tooltip);

series.bullets.push(function () {
  return am5.Bullet.new(root, {
    sprite: am5.Circle.new(root, {
      radius: 5,
      fill: series.get("fill"),
      stroke: root.interfaceColors.get("background"),
      strokeWidth: 2
    })
  });
});

// Add cursor
// https://www.amcharts.com/docs/v5/charts/xy-chart/cursor/
var cursor = chart.set(
  "cursor",
  am5xy.XYCursor.new(root, {
    xAxis: xAxis
  })
);
cursor.lineY.set("visible", false);

// Make stuff animate on load
// https://www.amcharts.com/docs/v5/concepts/animations/
series.appear(1000, 100);
chart.appear(1000, 100);

// Set up export and annotation
var exporting = am5plugins_exporting.Exporting.new(root, {
  menu: am5plugins_exporting.ExportingMenu.new(root, {})
});

var annotator = am5plugins_exporting.Annotator.new(root, {});

var menuitems = exporting.get("menu").get("items");

menuitems.push({
  type: "separator"
});

menuitems.push({
  type: "custom",
  label: "Annotate",
  callback: function() {
    this.close();
    annotator.toggle();
  }
});

style code

#chartdiv {
  width: 100%;
  height: 85vh;
}

How to get work in DB2?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.