Home Forums Chart Support canvasjs-chart-toolbar menu dom

canvasjs-chart-toolbar menu dom

Viewing 5 posts - 1 through 5 (of 5 total)
  • #43763

    Hello, I started looking at changing the menu selection from jpeg to jpg and found other items of interest.
    Can you provide an explanation for
    with reference to the canvasjs-chart-toolbar?

    I found in the forum some ways of adding an external button such as save to PDF, and I would like to know if I can embed a url, and what I need to know, class and id names, id’s, etc. to do other tasks.
    I looked for more info like this in the forum and docs but did not find any.

    Thank you.



    You can get the chart toolbar reference using document.getElementsByClassName("canvasjs-chart-toolbar")[0]. You can add extra options like ‘Export as PDF’ or pass url under it to the obtained toolbar reference. Also, please take a look at this JSFiddle for an example where “Export as CSV” feature is added to the toolbar.

    Export Multi-Series Chart data as CSV

    Manoj Mohan
    Team CanvasJS


    Manoj Mohan,

    Thank you for your reply. The example you provided confirms that document.getElementsByClassName("canvasjs-chart-toolbar")[0] is used as an array.

    I noticed this works similarly through CSS as:

    /*	change style of toolbar button	*/
    .canvasjs-chart-toolbar button {
    	width: 100px !important;
    	border: 1px solid black !important;
    /*	this css hides or displays multiple menu choices - 
    	0 = print, jpeg, png, 1 = jpeg, png, 2 = print, png, 3 = print, jpeg, 4 = 0	*/
    .canvasjs-chart-toolbar div>div:nth-child(3) {
    	display: none !important;

    The functions are also a good example but as I set a string using php for the filename with
    exportFileName: “$stg” .
    I do not know how the functions can be modified for that as they use filename numerous times.



    If you are looking to pass variable from PHP to JS, please refer to this page. If this doesn’t meet your requirement, kindly brief us further about your requirement so that we can understand your scenario better and help you out with an appropriate solution.

    Manoj Mohan
    Team CanvasJS


    I will modify the code accordingly and test.
    Thank you

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.