By default, the chart avoids clipping labels on either end of the plot area through auto-labeling. In your case, the labels are getting clipped since you are setting viewportMinimum. You can overcome this by either not setting viewportMinimum or by setting viewportMinimum to a value smaller than the required viewport minimum.
—
Thangaraj Raman
Team CanvasJS
Each dataseries can have its own yValueFormatString since it is set at the dataseries level.
You can use the toolTipContent property at the datapoint level to show custom information in the tooltip as shown in this updated JSFiddle.
—
Thangaraj Raman
Team CanvasJS
To render the equivalent of an info icon, you can add a scatter dataseries to the chart, and set an appropriate index label. The scatter points’ tooltip can be used to show any additional information as per your requirement.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
You can use an area chart and set fillOpacity to a minute value like 0.3 or 0.4 to reduce the transparency of the shaded area. To visualize the airplane image, you can position an image over the last datapoint to achieve your requirement.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
We have just added CanvasJS Chart & StockChart packages to NPM registry. Now, you can add our charts & stockcharts to your application via NPM. Please refer to the release blog for more information. Please check out our NPM package and let us know your feedback.
—
Thangaraj Raman,
Team CanvasJS
We have just added CanvasJS Chart & StockChart packages to NPM registry. Now, you can add our charts & stockcharts to your application via NPM. Please refer to the release blog for more information. Please check out our NPM package and let us know your feedback.
—
Thangaraj Raman,
Team CanvasJS
You can achieve zooming using mouse wheel by updating the viewportMinimum and viewportMaximum for both x-axis and y-axis based on the mouse position.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
To display data by month for multiple years in the form of a stack you can use a stackedArea chart and set the fillOpacity for each dataseries to 0 if you just want to render the lines and not the shaded region below. In case you want to want to render both the line and the shaded area below with lesser transparency, you can set fillOpacity to a minute value like 0.1 or 0.2. We suggest you to use labels for the months instead of passing date-time values to x-value.
Please check this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
You can zoom the chart using mousewheel by attaching wheel event to the chart. Please find the code snippet below.
document.getElementsByClassName("canvasjs-chart-canvas")[1].addEventListener("wheel", function(e){
e.preventDefault();
if(e.clientX < chart.plotArea.x1 || e.clientX > chart.plotArea.x2 || e.clientY < chart.plotArea.y1 || e.clientY > chart.plotArea.y2)
return;
var axisX = chart.axisX[0];
var viewportMin = axisX.get("viewportMinimum"),
viewportMax = axisX.get("viewportMaximum"),
interval = axisX.get("minimum");
var newViewportMin, newViewportMax;
if (e.deltaY < 0) {
newViewportMin = viewportMin + interval;
newViewportMax = viewportMax - interval;
}
else if (e.deltaY > 0) {
newViewportMin = viewportMin - interval;
newViewportMax = viewportMax + interval;
}
if(newViewportMin >= chart.axisX[0].get("minimum") && newViewportMax <= chart.axisX[0].get("maximum") && (newViewportMax - newViewportMin) > (2 * interval)){
chart.axisX[0].set("viewportMinimum", newViewportMin, false);
chart.axisX[0].set("viewportMaximum", newViewportMax);
}
});
Please take a look at this JSFiddle for a working example.
—
Thangaraj Raman
Team CanvasJS
Please check this documentation page for an example on using the yValueFormatString
property and the different formatting options supported. Also, please take a look at this gallery page example of a pie chart with percentage values in the tooltip as well as indexlabel.
In your case you can set yValueFormatString: "{y}%"
if you want to show the value in percentage or yValueFormatString: "{y}'%'"
if you want to add % symbol along with the current y-value.
—
Thangaraj Raman
Team CanvasJS
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