Forum Replies Created by Vishwas R

Viewing 15 posts - 751 through 765 (of 1,627 total)
  • in reply to: Calculate are under the chart #23825

    @a_gov,

    You can find the area of column by multiplying its height (y-value of the dataPoint) and width (width of the dataPoint). Please take a look at this JSFiddle, where area of individual columns are calculated when you click on it.


    Vishwas R
    Team CanvasJS

    in reply to: How can I use PHP MySQL Dynamic data #23824

    @gereby,

    The issue seems to be with the scope of the variables – chart, please refer this stackoverflow thread for more info on scope of a variable in JavaScript. Please find the working code-snippet below.

    var updateInterval = 100;
    var chart;
    var dps;
    $(document).ready(function() {
    	$.getJSON("testdata.php", function(result) {
    		dps = result;
    		chart = new CanvasJS.Chart("chartContainer", {
    			title: {
    				text: "Test",
    			},
    			axisY: {
    				minimum: 0,
    				maximum: 1000
    			},
    			data: [{
    				type: "stackedBar",
    				dataPoints: dps
    			}]
    		});
    
    		chart.render();
    	});
    
    	var updateChart = function() {
    		$.getJSON("testdata.php", function(result) {
    			dps.splice(0, dps.length);
    			$.each(result, function(index, value) {
    				dps.push(value);
    			});
    		});
    
    		chart.render();
    	};
    
    	setInterval(function() {
    		updateChart()
    	}, updateInterval);
    });

    Please take a look at this php file for complete code.


    Vishwas R
    Team CanvasJS

    in reply to: Data on line graph #23823

    @madhuri,

    The page seems to show JSON and not HTML content as you are setting header. Removing the header should work fine in your case, please take a look at this updated code. Please checkout our PHP Gallery for more examples, you can also download PHP samples from our download page and try running it locally.


    Vishwas R
    Team CanvasJS

    @skis89,

    When there are large number of dataPoints, markers are automatically disabled. You can override this by setting markerSize in dataSeries.


    Vishwas R
    Team CanvasJS

    @ttquang1063750,

    The behavior of stacked-area is by design. We will reconsider this behavior in future releases.


    Vishwas R
    Team CanvasJS

    in reply to: Reading Exernal data from URL not working in line Graph #23807

    @bjndugga,

    Can you kindly share sample project over Google-Drive or Onedrive so that we can run it locally at our end, understand the use-case better and help you out.


    Vishwas R
    Team CanvasJS

    in reply to: Line chart with bar chart #23806

    @nisha,

    In the JSFiddle provided in previous reply, calculateTrendLine method calculates trend-line dynamically based on dataPoints passed to chart, irrespective of source of dataPoints. Please refer this stackexchange thread for more info on calculating trend-line / Y=mx+b.

    If adding calculateTrendLine method doesn’t work in your case, kindly share sample project with sample database over Google-Drive or Onedrive, so that we can look into your code, understand it better and help you out.


    Vishwas R
    Team CanvasJS

    in reply to: Uncaught TypeError: jQuery.getJSON is not a function #23805

    Victor,

    Kindly make sure you are including jQuery in your project, and not jQuery slim – which excludes AJAX and animation effects modules. Including jQuery instead of slim should work fine in this case. Please refer this to stackoverflow thread for more information.
    Column Chart with JSON Data

    If you are still facing issue, kindly create a sample project reproducing the issue you are facing & share it with us over Google-Drive or Onedrive so that we can look into your code, understand the scenario better and help you out.


    Vishwas R
    Team CanvasJS

    in reply to: Is there a way to separate the pan and zoom buttons? #23804

    @skis89, @intijk,

    Sorry, this feature is not available as of now.


    Vishwas R
    Team CanvasJS

    in reply to: Editable legends #23796

    @tejal,

    Please take a look at this JSFiddle.


    Vishwas R
    Team CanvasJS

    in reply to: Undefined vars in "use strict" mode with webpack #23791

    @tonichazigz,

    Apologies for the inconvenience caused. The issue seems to be due to the breaking changes in Webpack that was introduced in v2.2.0-rc.5 since when you can mix require and export whereas you can’t mix import and module.exports. Please take a look at this sample project that works fine with Webpack 2.4.1.
    column chart with webpack


    Vishwas R
    Team CanvasJS

    in reply to: Running in node.js #23790

    @bjndugga,

    The link shared seems to be working fine. Here is the download link for your reference: https://1drv.ms/u/s!Am6ZJqYg9ZmfgglW57iRB6azpcX_


    Vishwas R
    Team CanvasJS

    in reply to: Reading Exernal data from URL not working in line Graph #23789

    @bjndugga,

    Please take a look at this sample project on integrating CanvasJS in NodeJS.


    Vishwas R
    Team CanvasJS

    in reply to: Need help with Date time values in XAxis #23788

    @hackkpo,

    that query gives me 5000+ records, divided by 15 minutes in all the records from this year, but the x axis shows me this range

    Range of x-axis depends on the dataPoints, if minimum/maximum or viewportMinimum/viewportMaximum are not set. Kindly share JSFiddle with sample data so that we can look into the chart-options you are using, understand the scenario better and help you out.

    And when you put the cursor on it, it says “18 Jan 70”, what it means?

    Tooltip content is showing 1970 as the timestamp that you are passing to the dataPoints are PHP Timestamp. PHP uses Unix timestamp which is in seconds whereas JavaScript uses milliseconds as timestamp. Converting PHP timestamp to JS timestamp by multiplying PHP timestamp by 1000 should work fine in your case.


    Vishwas R
    Team CanvasJS

    in reply to: Calculate are under the chart #23774

    @a_gov,

    Do you mean to show gridlines on top of area chart? If so please take a look at this JSFiddle which shows adding striplines at every interval over axisY to show gridlines on top of columns without reducing the opacity of columns.

    If not, can you kindly brief your requirements further, so that we can understand it better and help you out?


    Vishwas R
    Team CanvasJS

Viewing 15 posts - 751 through 765 (of 1,627 total)