Forum Replies Created by Ananya

Viewing 15 posts - 16 through 30 (of 30 total)
  • in reply to: Problem multi charts #45069

    @patdepri_new,

    You are attempting to create a chart in the div with id “chartContainer1” which does not exist. So the code stops executing and does not render anything on screen. Please check browser console for the error. Not creating chart with the id that doesn’t exist should render all other charts in this case.


    Ananya Deka
    Team CanvasJS

    in reply to: Problem multi charts #45047

    @patdepri_new,

    Rendering multiple charts in a page seems to be working fine. Please refer to this documentation page for a step-to-step walkthrough of the same. If you are still facing issue, kindly create a JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out.

    Multiple Charts in a Page


    Ananya Deka,
    Team CanvasJS

    in reply to: Bullet Chart and Gauge chart support #44939

    @intellicus,

    Thank you for the valuable feedback. As a workaround, you can combine Stacked Bar 100 and Bar Chart to achieve Bullet Chart as shown in this JSFiddle. Similarly, you can use Doughnut Chart to create a Gauge Chart, as shown in this JSFiddle.

    CanvasJS Bullet Chart

    You can refer to this article for more information about creating Bullet Chart using our library.


    Ananya Deka
    Team CanvasJS

    in reply to: Choose zoom type #44840

    @ss12,
    You can add a dropdown to select the zoomtype as shown in this JSFiddle.

    Change ZoomType in Chart


    Ananya Deka
    Team CanvasJS

    in reply to: how to enable export csv in canvas js angualr chart #44715

    @himak,

    Exporting chart data as CSV is not available as an in-built feature as of now. However, with few lines of code, you can achieve the same as shown in this JSFiddle. You can even use the export-canvasjs-chart-data-as-csv npm package to export chart data as CSV in Angular app. Please take a look at this Stackblitz project for an example of the same.

    Exporting Angular Chart Data as CSV


    Ananya Deka
    Team CanvasJS

    in reply to: Creating a chart from a JSON file #44692

    @murrayr,

    Due to security measures, web browsers impose restrictions on reading local files & cross-origin requests. To work around this, one effective approach is to serve your JSON file from a local web server or utilize a CORS-enabled JSON hosting service like npoint.io. By doing so, you enable your web application to fetch data seamlessly without encountering the cross-origin limitations. Please take a look at this JSFiddle for an example of the same.

    Column chart with data from JSON file


    Ananya Deka,
    Team CanvasJS

    in reply to: When exporting a chart to PNG, change the axis color. #44665

    sora,

    To change the axis colour before exporting the chart, you can change the theme to a light theme before export and revert it back after. Please take a look at this JSFiddle for an example of the same.

    Changing Theme in the Exported Image


    Ananya Deka
    Team CanvasJS

    in reply to: rangeChanged firing while panning #44629

    @fdelvalle,

    1) What is the difference between rangeChanging and rangeChanged then? They seem to fire just one after another.

    rangeChanging is fired just before the range of the chart is about to be changed, i.e., before rendering takes place. rangeChanged is triggered after the chart has been rendered with the updated viewport range. rangeChanging can be useful for modifying chart options based on the new range before the chart updates, while rangeChanged is suitable for tasks that need to react to the finalized change in the range.

    2) Is there a way to detect when the Pan ends? My intention is to query the database for new values only when Pan or Zoom ends.

    You can check if panning has ended or not with the help of rangeChanged event and mouseup event. Please check the code-snippet below.

    rangeChanged: function(e) {
          if(e.trigger === 'pan') {
            panning = true;
          }
        }
    
    document.addEventListener('mouseup', function () {
        if(panning) {
          // query your database here
          panning = false;
        }
      });

    Please take a look at this JSFiddle for an example of the same.

    Ananya Deka
    Team CanvasJS

    in reply to: rangeChanged firing while panning #44611

    @fdelvalle,

    While panning, the axis range is being changed as you move the mouse along the chart and hence rangeChanged will be fired at every instance. In contrast, while zooming the range is changed only once after the desired range has been selected, and as a result rangeChanged is fired only once. The sequence of fired events while panning, i.e., rangeChanging followed by rangeChanged, is the intended behaviour.


    Ananya Deka
    Team CanvasJS

    @kkoroleva,

    We don’t have CanvasJS Charts TypeScript definition as of now. However, charts seems to work fine with TypeScript as well. You can ignore the corresponding error by adding //@ts-ignore above the import statement as shown in the code-snippet below:

    //@ts-ignore
    import * as CanvasJS from '@canvasjs/charts';


    Ananya Deka
    Team CanvasJS

    @kkoroleva,

    You can import CanvasJS from @canvasjs/charts package directly in this case. Please find the code-snippet below.

    import * as CanvasJS from '@canvasjs/charts';
    

    Please check out CanvasJS npm package from this link.


    Ananya Deka
    Team CanvasJS

    in reply to: Large Data Query Question #44546

    Doug,

    You can use rangeChanging event to update the data with a new set of datapoints based on the zoomed range. Please take a look at this JSFiddle for an example of the same.
    Data Filtering in Column Chart

    —-
    Ananya Deka
    Team CanvasJS

    Aung,

    Range Selector is a part of StockChart, and not Chart. Using StockChart instead of Chart should fulfill your requirement.

    StockChart With Range Selector

    __
    Ananya Deka
    Team CanvasJS

    in reply to: Convert chart to base64 image #44096

    @lujakob

    You can get base64 image data of a canvas by using toDataURL method. As CanvasJS charts are rendered on canvas, you can use toDataURL to get base64 image data of the chart. Please find the code-snippet below:

    var base64Image = chart.canvas.toDataURL();

    Please take a look at this JSFiddle for a working example.

    Export Chart as Base64 Image


    Ananya Deka
    Team CanvasJS

    in reply to: Stacked Column Wrong Label X #43973

    @danura,

    In case of Stacked Charts, datapoints across multiple dataseries are aligned based on x-values and not the labels. Passing x-value along with label should work fine in this case. Please take a look at this JSFiddle for an example.


    Ananya Deka
    Team CanvasJS

Viewing 15 posts - 16 through 30 (of 30 total)