You seem to be using undocumented methods and properties. addTheme
is an internal property with certain functionality and might not apply font-size as defined across all the elements in the chart. We suggest you use chart.options
to set the labelFontSize in this case since it will apply the font-size based on the defined value.
—
Thangaraj Raman
Team CanvasJS
Only one label will be shown for a stripline, as of now. However, you can add 2 additional striplines, one at the startValue position and the other at the endValue position, and use their individual labels to achieve your requirement.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
The click event is fired only within the area of the marker as of now. However, you can set markerBorderThickness to a value greater than 0 and markerBorderColor to transparent to increase the area in which the click event is fired without changing the size of the marker.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
Showing fewer datapoints based on the screen size of the device is not available as an inbuilt feature as of now. However, you can achieve the same with a few lines of code. Please check the code snippet below.
var screenWidth = jQuery(window).width();
var dpsCount = 6; //no. of datapoints to be displayed on phone
var dps = [];
if(screenWidth <= 768 ) {
for(var i = 0; i < dpsCount; i++) {
dps.push(chart.options.data[0].dataPoints[i]);
}
chart.options.data[0].dataPoints = dps;
chart.render();
}
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
Chart elements may look blurred on changing the zoom level within the display setting of the browser or windows. Resetting the zoom level to 100% should work fine in this case.
—
Thangaraj Raman
Team CanvasJS
We are unable to reproduce the issue at our end, the chart seems to be proper & not blurry. Can you kindly provide more information like the version of CanvasJS & the browser that you are using so that we can try reproducing with the same environment?
—
Thangaraj Raman
Team CanvasJS
Shashi,
For your case, we suggest you to use separate variables for each chart instance or to keep all the chart instances in an array as shown below.
var chartsArray = [];
chartsArray.push(new CanvasJS.Chart("chartContainer1", { //Chart 1 Options }));
chartsArray.push(new CanvasJS.Chart("chartContainer2", { //Chart 2 Options }));
for(var i = 0; i < chartsArray.length; i++) {
chartsArray[i].render();
}
—
Thangaraj Raman
Team CanvasJS.
@avb,
The JSFiddle that you have shared seems to be broken. Could you please share an updated JSFiddle with working code so that we can look into the code/chart options being used, understand the scenario better, and help you out?
Also, we are unable to understand what you mean by center the chart data with a blank space on the right instead of filling till the end. Could you please brief us further with a pictorial representation or an example with the steps to understand your requirement so that we can suggest an appropriate solution?
—
Thangaraj Raman
Team CanvasJS
Changing the cursor while hovering over the underlying area of an area chart is not possible as of now.
—
Thangaraj Raman
Team CanvasJS
You can bind mouse events to the chart container and get mouse coordinates in pixels, which can be converted to corresponding values along the axis using convertPixelToValue as shown in this documentation page. Please take a look at the code snippet below:
jQuery(".canvasjs-chart-canvas").last().on("click",
function(e){
var parentOffset = $(this).parent().offset();
var relX = e.pageX - parentOffset.left;
var xValue = Math.round(chart.axisX[0].convertPixelToValue(relX));
console.log(xValue);
});
—
Thangaraj Raman
Team CanvasJS
Sorting datapoints by x values using the below code snippet seems to be working fine for data-time values as well. Please check this JSFiddle for a working example.
function compareDataPointX(dataPoint1, dataPoint2) {
return dataPoint1.x - dataPoint2.x;
}
If you are still facing issues, kindly create a sample project reproducing the issue and share it with us over Google Drive or OneDrive so that we can look into the code, run it locally to understand the scenario better, and help you out.
—
Thangaraj Raman
Team CanvaSJS
Glad you were able to figure it out. As of now, AJAX call has to be performed separately, and chart options can be updated based on the data fetched from it.
—
Thangaraj Raman
Team CanvasJS