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

Empty Chart always shows even using your example flow provided #20

Open
converseKarl opened this issue Mar 7, 2021 · 2 comments
Open

Comments

@converseKarl
Copy link

converseKarl commented Mar 7, 2021

Running latest nodered, installed the node-red-contrib-chartjs package 0.5.2

installed the flow examples (examples folder), deploy, inject the sample. Hit the local host URL /POV example, and even /POH and empty charts are shown

code in browser shows html header, meta, link, script lib references, and the chart container and cavas.

@juggledad
Copy link

juggledad commented Aug 16, 2022

Just tested this on NR v3.0.2 and node-red-contrib-chartjs v0.5.2 running on macOS v12.5 and it works fine.
To open a chart you must use yourIP:1880/XXX where xxx is the PATH named in the node. and you have to open the browser to that path before injecting the data to the node.

For example, if you want to run Population Radar Chart (last example) and NR is running on 192.168.1.50, you would first open a window with http://192.168.1.50:1880/POR and then press the 'inject' button for that flow.

After playing with it a bit, personally I wouldn't use it because if you refresh to chart window in the browser, the data disappears and you have to go back and trigger the sending of the data to te chart again to see it.

@inxiot
Copy link

inxiot commented Jan 23, 2023

I got a same situation ( empty chart ) .
Followings are the example flow and resulted HTML
Hope any useful advice to solve this probmem.

[Flow]
[
{
"id": "7731c057.0fb3f",
"type": "chartjs-line",
"z": "6b636b71c28c1993",
"name": "Temperature Chart",
"path": "AAA",
"charttitle": "Temperature Chart",
"xaxis": "Dates",
"yaxis": "Temperature [℃]",
"x": 340,
"y": 380,
"wires": [
[
"32839842.a38f18"
]
]
},
{
"id": "af2ee033.db3ba",
"type": "inject",
"z": "6b636b71c28c1993",
"name": "Dataset",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{"channel":"AAA","color":"Red","dataset":[{"x":"01/02/2019 10:00","y":10},{"x":"01/02/2019 13:00","y":8},{"x":"01/02/2019 16:20","y":15}]}",
"payloadType": "json",
"x": 150,
"y": 380,
"wires": [
[
"7731c057.0fb3f"
]
]
},
{
"id": "32839842.a38f18",
"type": "debug",
"z": "6b636b71c28c1993",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 380,
"wires": []
}
]

[HTML]

--   |   |   |   |     |   |   |     | <script type="text/javascript" src="chartjs/js/jquery-3.3.1.min.js"></script>   | <script type="text/javascript" src="chartjs/js/popper.min.js"></script>   | <script type="text/javascript" src="chartjs/js/bootstrap.min.js"></script>   | <script type="text/javascript" src="chartjs/js/Chart.min.js"></script>   | <script type="text/javascript" src="chartjs/js/socket.io.js"></script>   | <script type="text/javascript" src="chartjs/js/jspdf.min.js"></script>   |     | <script type="text/javascript" src="chartjs/templates/line-chart.js"></script>   | <title>Chart.js samples</title>   |   |   |   | Chart.js RED   |     |
  |   |
  |   |     |
  |   |
  |   |
	<link rel="stylesheet" type="text/css" href="[chartjs/css/bootstrap.min.css](https://skx.ggtech-dx.com/nr/chartjs/css/bootstrap.min.css)">
	<link rel="stylesheet" type="text/css" href="[chartjs/templates/line-chart.css](https://skx.ggtech-dx.com/nr/chartjs/templates/line-chart.css)">

	<script type="text/javascript" src="[chartjs/js/jquery-3.3.1.min.js](https://skx.ggtech-dx.com/nr/chartjs/js/jquery-3.3.1.min.js)"></script>
	<script type="text/javascript" src="[chartjs/js/popper.min.js](https://skx.ggtech-dx.com/nr/chartjs/js/popper.min.js)"></script>
	<script type="text/javascript" src="[chartjs/js/bootstrap.min.js](https://skx.ggtech-dx.com/nr/chartjs/js/bootstrap.min.js)"></script>
	<script type="text/javascript" src="[chartjs/js/Chart.min.js](https://skx.ggtech-dx.com/nr/chartjs/js/Chart.min.js)"></script>
	<script type="text/javascript" src="[chartjs/js/socket.io.js](https://skx.ggtech-dx.com/nr/chartjs/js/socket.io.js)"></script>
	<script type="text/javascript" src="[chartjs/js/jspdf.min.js](https://skx.ggtech-dx.com/nr/chartjs/js/jspdf.min.js)"></script>

	<script type="text/javascript" src="[chartjs/templates/line-chart.js](https://skx.ggtech-dx.com/nr/chartjs/templates/line-chart.js)"></script>
	<title>Chart.js samples</title>
</header>
<body>
	<nav id="toolbar" class="navbar navbar-expand-lg navbar-light bg-light">
		<a class="navbar-brand" href="[#](https://skx.ggtech-dx.com/nr/AAA#)">Chart.js RED</a>
				
		<div class="collapse navbar-collapse flex-grow-1 text-right">
			<ul class="navbar-nav ml-auto flex-nowrap">
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" id="navbarDropdown" href="[#](https://skx.ggtech-dx.com/nr/AAA#)" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					Export Chart
					</a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
						<a id='image' class="dropdown-item" href="[#](https://skx.ggtech-dx.com/nr/AAA#)">Export to Image</a>
						<a id='pdf' class="dropdown-item" href="[#](https://skx.ggtech-dx.com/nr/AAA#)">Export to Pdf</a>
					</div>
				</li>
			</ul>
		</div>			
	</nav>		
	
	<div id="container" style="width: 100%; height: 100vh; overflow: auto;">
		<canvas id="chart"></canvas>
	</div>
</body>

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

3 participants