未捕获的TypeError:fn不是chart.js中的函数

时间:2016-02-19 23:11:29

标签: javascript jquery chart.js

这是我第一次使用chart.js进行线路聊天,它可以在我的本地主机上工作,但是当我将它上传到远程主机时,我发现折线图没有显示所以我检查了元素并发现了这个错误安慰。请问可能是什么问题。

VALUES ('', '$Email', ...

这是实施脚本

Uncaught TypeError: fn is not a function     chart.js:501

3 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,但answer to an identical question: Uncaught TypeError 帮我解决了问题。尝试拆分全局配置,而不是在声明新对象时擦除所有全局值。而是像这样单独声明变量......



Chart.defaults.global.animation = true;
Chart.defaults.global.animationSteps = 60;
Chart.defaults.global.animationEasing = "easeOutQuart";
Chart.defaults.global.showScale = true;
Chart.defaults.global.scaleOverride = false;
Chart.defaults.global.scaleSteps = null;
Chart.defaults.global.scaleStepWidth = null;
Chart.defaults.global.scaleStartValue = null;
Chart.defaults.global.scaleLineColor = "rgba(0,0,0,.1)";
Chart.defaults.global.scaleLineWidth = 1;
Chart.defaults.global.scaleShowLabels = true;
Chart.defaults.global.scaleLabel = "<%=value%>";
Chart.defaults.global.scaleIntegersOnly = true;
Chart.defaults.global.scaleBeginAtZero = false;
Chart.defaults.global.scaleFontFamily = "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
Chart.defaults.global.scaleFontSize = 12;
Chart.defaults.global.scaleFontStyle = "normal";
Chart.defaults.global.scaleFontColor = "#666";
Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = true;
Chart.defaults.global.showTooltips = true;
Chart.defaults.global.customTooltips = false;
Chart.defaults.global.tooltipEvents = ["mousemove", "touchstart", "touchmove"];
Chart.defaults.global.tooltipFillColor = "rgba(0,0,0,0.8)";
Chart.defaults.global.tooltipFontFamily = "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
Chart.defaults.global.tooltipFontSize = 14;
Chart.defaults.global.tooltipFontStyle = "normal";
Chart.defaults.global.tooltipFontColor = "#fff";
Chart.defaults.global.tooltipTitleFontFamily = "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
Chart.defaults.global.tooltipTitleFontSize = 14;
Chart.defaults.global.tooltipTitleFontStyle = "bold";
Chart.defaults.global.tooltipTitleFontColor = "#fff";
Chart.defaults.global.tooltipYPadding = 6;
Chart.defaults.global.tooltipXPadding = 6;
Chart.defaults.global.tooltipCaretSize = 8;
Chart.defaults.global.tooltipCornerRadius = 6;
Chart.defaults.global.tooltipXOffset = 10;
Chart.defaults.global.tooltipTemplate = "<%if (label){%><%=label%>: <%}%><%= value %>";
Chart.defaults.global.multiTooltipTemplate = "<%= value %>";
Chart.defaults.global.onAnimationProgress = function() {};
Chart.defaults.global.onAnimationComplete = function() {};
&#13;
&#13;
&#13;

答案 1 :(得分:0)

这意味着您的选项存在问题

检查值,例如 tooltipTemplate:<%if (label){%><%=label%>: <%}%><%= value %>

答案 2 :(得分:0)

您应该关闭选项asp_tags,这可能只发生在您的在线版本而不是本地版本。

当asp标签打开时,它会中断: {“multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"}