Relative Content

Tag Archive for javascriptchart.js

ChartJS v4 – Using Points in a line chart will result in all x-values at 0

I am facing a rather strange problem with line charts and ChartJS. Given the following very simple code. I expect to have a line chart where 3 data points (at x: 0, x:1 and x: 2). But instead, all points are shown at x:0. According to the docs: https://www.chartjs.org/docs/latest/charts/line.html#data-structure it should be possible to use the given notation to draw the line graph.

on second visit chart and button not working

<?php if (!isset($_SESSION)) { session_start(); } if (!isset($_SESSION[“loggedin”])) { if (!header(“Location: index.php”)) { header(“Location: index.php”); die(“Unauthorized access”); } else { header(“Location: index.php”); } } require_once “DBClasses/restaurants.php”; require_once “DBClasses/billsettlement.php”; ?> <!DOCTYPE HTML> <html lang=”en”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <meta name=”apple-mobile-web-app-capable” content=”yes”> <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”> <meta name=”viewport” content=”width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover” /> <title>GalaxyNx Reports</title> […]

Chart.js use one canvas to display different charts based on user selection (button)

I’m building a program that will display different economic data charts for different countries (currently between Canada and US). I was hoping to have one canvas for each type of chart and change it depending on what button the user clicks on. For example, I would have one canvas that displays Gross Domestic Product for US when the user clicks on the US button and Canada when the user clicks on the Canada button. I am planning on doing this for multiple canvases (Inflation Rate, Retail Sales, etc.) but right now I only have the one for GDP. The problem I’m having is that when I load the webpage, it displays the default country I selected but it doesn’t change when I click on the other button. I saw that there was a similar issue but I haven<t been able to make the solution work for me.

Chart.js fails to hide grid on axis

I’m creating a Chart.js graph and I want to hide the scales and grid to have a “cleaner” design but I’m having difficulties hiding that stuff.