canvasjs

Removing NaN from date time returned in javascript

半城伤御伤魂 提交于 2020-05-04 06:56:30
问题 I am working on yii2 . In my javascript, I have a formula through which I am getting some data. The data is then passed to chart and chart renders it. var arry_kwh = []; arry_kwh = <?php echo json_encode($dataPointskWh, JSON_NUMERIC_CHECK); ?>; var arry_kwh_diff = []; var i = 0; for (; i < arry_kwh.length - 1; i++) { arry_kwh_diff[i] = { label: arry_kwh[i].label + ((arry_kwh[i + 1].label - arry_kwh[i].label) / 2), y: (arry_kwh[i + 1].y - arry_kwh[i].y) }; } console.log(JSON.stringify(arry_kwh

Array to string conversion while using canvas js in yii2

坚强是说给别人听的谎言 提交于 2020-04-30 09:17:38
问题 I am trying to load a chart on my index page in yii2 project . Below is my code <?PHP $dataPoints1 = array( array("label"=> "2010", "y"=> 36.12), array("label"=> "2011", "y"=> 34.87), array("label"=> "2012", "y"=> 40.30), array("label"=> "2013", "y"=> 35.30), array("label"=> "2014", "y"=> 39.50), array("label"=> "2015", "y"=> 50.82), array("label"=> "2016", "y"=> 74.70) ); $dataPoints2 = array( array("label"=> "2010", "y"=> 64.61), array("label"=> "2011", "y"=> 70.55), array("label"=> "2012",

How to re-render canvasjs chart with animation?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 02:17:07
问题 So far I've been successfully updating the data for the my chart following the guide in this link. However, how can do re-render it but with the same animation when it was first rendered? 回答1: It's somehow a hack and I know it shouldn't be this way but the only solution I found was to reinitialize the creation of the chart just to achieve that animation. 来源: https://stackoverflow.com/questions/28147817/how-to-re-render-canvasjs-chart-with-animation

CanvasJS: Making a chart dynamic with data.php, json encode and ajax(bandwidth meters)

元气小坏坏 提交于 2020-01-23 17:07:05
问题 First things first, I am trying to parse the data from a data.php file that uses json encode to echo a datapoint. The datapoint is updated every time the data.php file is requested, but not in a series of datapoints. Instead it just changes the time value and refreshes its y content. I haven't found a working way to actually make the php file echo series of datapoints and not update a single one. Next up, the chart parses the data.php file and it indeed shows the datapoint. BUT I want to make

Use variable to assign data points in creating CanvasJS graph?

帅比萌擦擦* 提交于 2019-12-25 02:47:20
问题 I've been playing around with CanvasJs - but I'm having a problem generating a chart using form input fields that represent a data point. For example, if I have the following input field that I want to graph: <input id="box1">: 1st value <input id="box2">: 2nd value <input id="box3">: 3rd value I have tried the following modification, trying to hold the input variables in an array, albeit without success: var diff = { first: $('#box1').val(), second: $('#box2').val(), third: $('#box3').val()

CanvasJS Multiple Charts

纵然是瞬间 提交于 2019-12-24 09:09:41
问题 Im working with a quiet nice little js tool called CanvasJS. It works perfectly fine until I needed it to display more than one Chart at once. Right now it just displays the last entry. Enerything else is being ignored. I tried pretty much everything, but simply can't figure out why it wont't work. If someone has an idea how I coud make it mork propperly, I would be verry verry happy if you let me know. VERSION: CanvasJS – v1.0 GA Type: Line Script: http://pastebin.com/hXVBkS8E Tool URL:

How to show only first and last labels in CanvasJS

自作多情 提交于 2019-12-13 10:21:07
问题 I need to show first and last labels only in CanvasJS. It's always showing all the labels but my requirement is to show only first and last. Is there any way out to do so? 回答1: You can use axisY labelFormatter to do so. var chart = new CanvasJS.Chart("chartContainer", { title: { text: "Chart showing only First and Last Axis Labels", }, axisY: { tickColor: "transparent", labelFormatter: function(e){ if(e.chart.axisY[0].minimum === e.value || e.chart.axisY[0].maximum === e.value) return e.value

Making a pie chart bigger without affecting the doughnut chart

若如初见. 提交于 2019-12-13 08:59:15
问题 I am making a pie chart and doughnut chart using canvasjs . I have the pie chart inside a doughnut chart. I am not that good when it comes to CSS. Here the pie chart is at the center, but still it is very small. I don't know how to make it bigger as it is messing up the pie chart if I am attempt to make it bigger. Is there any way the pie chart can be made bigger so there would not be much space between pie chart and the doughnut chart. I am posting a picture of my result here. I am using

canvasjs render is not a function

余生长醉 提交于 2019-12-11 03:22:04
问题 I'm trying to create a chart using CanvasJS but I'm getting the following error: Uncaught TypeError: b[a].render is not a function w.render @ canvasjs.min.js:84 Aa.Chart.render @ canvasjs.min.js:412 window.onload @ statistics:107 The code is the example code found on their website: <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { title:{ text: "Number of Students in Each Room" }, axisX:{ title:

Loop in order to generate data points in Javascript

♀尐吖头ヾ 提交于 2019-12-08 07:52:36
问题 I am trying to generate an area graph for two (or more) products i.e. Mosquito Repellents and Liquid Soap. I am using the JavaScript library CanvasJS to do that. The problem is that I need approximately 2000 data points instead of 4 hardcoded here and the problem is that I am unable to generate a for loop for two (or more) products that will do this for me. Can anyone help me on how to create this loop? var chart = new CanvasJS.Chart("chartContainer", { data: [{ type: "area", name: "Mosquito