It seems to be working fine with SQL Server(v14.0.1000.169) and PHP versions (v7.0+). Kindly check with the PHP v7.0+ as there seems to be an issue with SQL Driver and PHP v5.6. Once connected kindly check whether the data you are receiving from the database is being parsed to the format accepted by CanvasJS ({label: “Apple”, y: 6}) or not.
—–
Manoj Mohan
Team CanvasJS
You can use column chart with search value on axisY and search terms as label on axisX as shown in this tutorial.
—–
Manoj Mohan
Team CanvasJS
You seemed to be creating chart everytime you click on the button. I would suggest you to create chart once, outside graphGenerate method and update the chart within the method. Also kindly confirm whether the y-values are numeric or not.
If this doesn’t help you resolve the issue, kindly share sample project over Google-Drive / Onedrive so that we can run it locally at our end, understand the scenario better and help you out.
——
Manoj Mohan
Team CanvasJS
In case of range-charts, indexlabels will be shown for both minimum and maximum values. However, you can customize it to show only once by using indexLabelFormatter as shown in this JSFiddle.
—-
Manoj Mohan
Team CanvasJS
Can you kindly share a sample project over Google-Drive or Onedrive and brief more about your requirements so that we can understand it better and help you out?
—–
Manoj Mohan
Team CanvasJS
Adding exploded property to dataPoints after reading it from the database and parsing it should work fine in this case.
If you are still facing the issue, kindly share a sample project along with sample database over Google-Drive or Onedrive so that we can run it locally at our end, understand the scenario better and help you out.
—-
Manoj Mohan
Team CanvasJS
Sorry, range for x-values is not supported as of now. However, you can take a look at range charts like range-column, range area, range spline area that accepts range of y-values.
—–
Manoj Mohan
Team CanvasJS
Please take a look at the following examples to create a chart from database using:
To auto-refresh the chart every 3 seconds, you can use setInterval() method to call an AJAX request whose response can be parsed to update the chart dataPoints accordingly. Please take a look at this documentation page for updating chart dynamically using an AJAX request.
In case the above resource doesn’t help, can you kindly let us know the Server Side technology you are using so that we can help you out with an appropriate solution?
—–
Manoj Mohan
Team CanvasJS
We are looking into your query and will get back to you at the earliest.
—–
Manoj Mohan
Team CanvasJS
Please take a look at this Gallery Example for rendering chart with data from the database. You can also download PHP sample from our download page.
If this doesn’t help you resolve the issue you are facing, kindly share sample project along with sample database over Google Drive / One Drive so that we can run it locally at our end, understand the scenario better and help you resolve it.
—-
Manoj Mohan
Team CanvasJS
You are passing Column
as chart-type in the code shared above which is not a valid chart-type. Changing chart-type from Column
to column
should work fine in your case. Please take a look at this updated sample.
Please refer to this documentation page for more information about chart-types available in CanvasJS.
—–
Manoj Mohan
Team CanvasJS