Forum Replies Created by Manoj Mohan

Viewing 15 posts - 46 through 60 (of 804 total)
  • in reply to: Update chart with new date #44406

    @rcweb,

    Parsing data received from the post request & passing it to chart-option before rendering it should work fine in your case. You are trying to perform another request inside the success of AJAX request, which is redundant. Please take a look at the code-snippet below.

    
    $.ajax({
      url : 'chart.php',
      type : 'POST',
      data : {startDate:startDate,endDate:endDate},
      success : function(data) {
        var chart = new CanvasJS.Chart("chartContainer", {
          data: [
            {
    
              indexLabel: " {y}",
              indexLabelFontSize: 16,
    
              dataPoints: data
            }
          ]
        });
    
        chart.render();
    
      }
    });

    If you are still facing the issue, kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end to understand the scenario better and help you out.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Angular charts with newest Angular 17.x #44394

    @themich,

    In Angular 17, by default components are generated as standalone application. You can import CanvasJSAngularChartsModule module into your standalone component as shown in the code snippet below.

    
    import { CanvasJSAngularChartsModule } from '@canvasjs/angular-charts';
    
    @Component({
      selector: 'app-root',
      standalone: true,
      imports: [CanvasJSAngularChartsModule],
      template: `
      <div>
       <canvasjs-chart [options]="chartOptions"></canvasjs-chart>
      </div>
      `,
    })
    

    Also, check out this StackBlitz sample for integrating CanvasJS Charts in Angular 17.

    If you are still facing the issue, kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end to understand the scenario better and help you out.

    CanvasJS Charts in Angular 17

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Update chart with new date #44388

    @rcweb,

    getJSON function is used to load/get the JSON from the URL not to send the data to PHP page. If you want to pass the date selected from calendar and fetch the data based on it, you need to perform post or get request using $.ajax to an API created in PHP which receives the date and return the data. You can then fetch the data received from the API using $.getJSON and pass it on the chart options to render the chart.

    If you are still facing the issue, kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end to understand the scenario better and help you out.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Stripline label is overlaping with bars of a bar chart #44380

    @himanshu-singhal,

    You can place the stripline labels outside the plotarea, so that it doesn’t overlap any columns. However, if you like to place it inside itself and like to move it away from the columns, you can increase the viewportMaximum of axisX. Please take a look at this updated JSFiddle for an example.

    Increase viewportMaximum to avoid overlap of stripline labels with column

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: How to make multi spline chart from specified columns of CSV #44371

    Aung,

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

    StockChart Elements

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: issue with next js build #44348

    @indxx,

    Importing ‘@canvasjs/react-stockcharts’ dynamically for client side rendering should resolve the issue happening with the build script as well. Please take a look at the code snippet below for the same.

    import dynamic from "next/dynamic";
    const CanvasJSStockChart = dynamic(() => import("@canvasjs/react-stockcharts").then((mod) => mod.default.CanvasJSStockChart ), { ssr: false });

    Also, check out this updated sample project for complete working code.

    —–
    Manoj Mohan
    Team CanvasJS

    in reply to: issue with next js build #44337

    @indxx,

    StockChart seems to be working fine with Next.js. Please take a look at this sample project for integration of CanvasJS StockChart with Next.js.

    If you are still facing the issue, kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end to understand the scenario better and help you out.

    CanvasJS StockChart in Next.js

    —-
    Manoj Mohan
    Team CanvasJS

    @ajit,
    You can use Range Column Chart to show base of the column at -150 by passing the first y values as -150 and second value same as your existing y value for column chart. Please take a look at the code snippet for the converting column to rangeColumn and starting column at -150.

    
    for(var i=0; i<chart.options.data[0].dataPoints.length; i++) {
      chart.options.data[0].dataPoints[i].y = [-150, chart.options.data[0].dataPoints[i].y]; 
    }
    chart.options.data[0].type = "rangeColumn";
    

    Also, check out this JSFiddle for complete working code.

    Column Starting from -150

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Show tooltip for all stockcharts #44282

    @mustadirmahmood,

    You can get access to stockchart object from event parameter of tooltip’s updated event as e.chart.stockChart. Please take a look at the code snippet below to show the tooltip across charts in stockchart based on nearest x value.

    
    function showTooltip(e) {
      var stockChart = e.chart.stockChart;
      var charts = stockChart.charts;
    
      for( var i = 0; i < charts.length; i++){
        if(charts[i] != e.chart) {
          charts[i].toolTip.showAtX(getNearestXValues(e.entries[0].xValue, charts[i].data[0].dataPoints));
        }
      }
    }
    
    function hideTooltip(e) {
      var stockChart = e.chart.stockChart;
      var charts = stockChart.charts;
    
      for( var i = 0; i < charts.length; i++){
        if(charts[i] != e.chart)
          charts[i].toolTip.hide();
      }
    }

    Also, check out this updated JSFiddle for the complete working code.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Border Radius for Chart #44266

    @anirudhspriyan,

    Are you looking to add border radius to chart container? If yes, you can add it through CSS as shown in the code-snippet below.

    
    .canvasjs-chart-canvas {
      border-radius: 12px;
    }
    
    #chartContainer {
      border: 1px solid #dedede;
      border-radius: 12px;
    }
    

    Also, check out this JSFiddle for complete working code.

    Add border-radius to Chart Container

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: URGENT : Need integrated solution – with ANGULAR 15 #44246

    @neha,

    You can create a chart with 3 y-axes for Current, Voltage, and Temperature and use the axisYIndex property to assign each dataseries to a particular y-axis.

    Please check this StackBlitz for a working example on the same.

    Angular Chart with Multiple Y-Axis


    Manoj Mohan
    Team CanvasJS

    in reply to: Chart initial height and width is un-control. #44172

    @m-usman,

    Chart height seems to be working fine on initial render. Can you kindly create JSFiddle reproducing the issue you are facing and share it with us so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: number after the decimal point #44121

    @rafdu01,

    To display numbers after decimal point in the axis labels, you can use valueFormatString. Also, if you are looking to format the values in the tooltip, you can use yValueFormatString.

    If you are still facing the issue, can you kindly share the pictorial representation of your requirement so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: number after the decimal point #44105

    @rafdu01,

    Can you kindly brief us more about your requirements, the format in which you would like to show the labels (9.0, 9.2, 9.4,…, 10 or 9, 10, 11,…) so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: number after the decimal point #44086

    @rafdu01,

    You can set valueFormatString: "#0.0" to show 1 decimal value in the axis labels. Please refer to our documentation page for more customization options available.

    —-
    Manoj Mohan
    Team CanvasJS

Viewing 15 posts - 46 through 60 (of 804 total)