Forum Replies Created by Manoj Mohan

Viewing 15 posts - 676 through 690 (of 807 total)
  • in reply to: canvasjs with python Flask #26617

    @alioune,

    As per the code snippet shared above, it looks like you are passing x-value as string in a dataPoint, whereas x-value can either be a numeric value or a dateTime value. Here is how you can make modify your index.html file:

    <html>
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>CanvasJS Chart Python Flask Sample</title>
            <script type="text/javascript" src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
            <script type="text/javascript">
                window.onload = function() {
                    var dps = [
                                {% for key,value in data.items() %}
                                    { x: {{key}}, y: {{value}} },
                                {% endfor %}
                    ];
                    var chart = new CanvasJS.Chart("chartContainer", {
                        title:{
                            text: "CanvasJS Chart Python Flask Sample"              
                        },
                        data: [              
                        {
                            // Change type to "doughnut", "line", "splineArea", etc.
                            type: "column",
                            dataPoints: dps
                        }
                        ]
                    });
                    chart.render();
                }
            </script>
            <style type="text/css">
            </style>
        </head>
        <body>
            <div id="chartContainer" style="width: 100%; height: 300px;"></div>
        </body>
    </html>

    You can also take look at this sample project for a working example with sample code on the integration of CanvasJS with python flask.

    If you are still facing the issue in integrating CanvasJS charts with python flask, kindly create a sample project reproducing the issue you are facing and share it with us(along with sample data) over Google-Drive or Onedrive so that we can run the sample locally at our end to understand the scenario better and help you out?

    CanvasJS Chart Python-Flask sample

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Animation on subsequent renders #26614

    @clement-e,

    Thanks for your suggestion. As of now, chart animates only on the first render – we will reconsider this behavior to animate on every re-render in future releases.


    Manoj Mohan
    Team CanvasJS

    in reply to: chart display question #26607

    @xwei,

    The innerHTML property allows reading and replacing everything within a given DOM element (HTML tag). In order to render a chart inside a div, you need to pass a unique id of div or DOM element of the div to CanvasJS.chart().

    Using two div containers with a unique id and calling render method for the respective chart on the selected tab should work fine in your case. Please take a look at this JSFiddle. Also, refer this JSFiddle for an example on charts within Bootstrap tabs.

    —-
    Manoj Mohan
    Team CanvasJS

    @girishacharya,

    From the error shown above, it seems there is no div with id BarContainer on executing the code to render the chart. You can try to define div with id BarContainer in your html file.

    Also, you can check out our Angular Charts Gallery for examples on integrating chart in angular app.

    Angular Charts & Graphs

    If you are still facing the issue, kindly share Sample Project along with sample data reproducing the issue over Google Drive / Onedrive so that we can look into the code, understand the scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Sync & Programatically Hightlight Chart #26587

    @ynatani,

    To highlight the dataPoint in a line chart, you can set markerSize of dataPoint to higher value. Please take a look at this JSFiddle which highlights the dataPoint when the button is clicked.

    If this doesn’t fulfill your requirement, kindly brief us more about requirement along with an example or pictorial representation so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Drilldown with Ajax and MVC #26581

    @hecatonchireslm,

    Can you kindly share sample project over Google-Drive / OneDrive along with sample data so that we can understand the scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Line chart #26571

    @zubairsaif,

    You can achieve the above requirements by setting color to dataPoints. Please take a look at this JSFiddle.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: canvasjs with python Flask #26569

    @alioune,

    Can you kindly share sample project over Google-Drive / OneDrive along with sample data and also brief us more about the issue you are facing so that we can understand the scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: How do I individually format legend item text styles? #26557

    @henry-zounetapp-com,

    As of now, it’s not possible to style the text of legend as link (underline).

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Drilldown with Ajax and MVC #26545

    @hecatonchireslm,

    Considering this thread as a duplicate of Drilldown with Ajax and MVC and hence closing the same.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: can draw rectangle or ellipse? #26544

    @y-hirano,

    You can use Scatter Chart with markerType set as circle, square to achieve your requirement.

    If this doesn’t fulfill your requirement, kindly share some example / pictorial representation and brief us more about your requirement so that we can understand scenario better and help out.

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: Chart changing with data size #26543

    @vb123er951,

    Please take a look at this JSFiddle.

    —-
    Manoj Mohan
    Team CanvasJS

    @gowri,

    There are couple of issue with the code that you have shared.

    1. You need to replace chartType with chart in chartType.options.data[0].type as chartType is referred to dropdown field not the chart object.
    chart.options.data[0].type = chartType.options[chartType.selectedIndex].value;

    2. Below code has to be inside the window.onload function as chart is inside window.onload scope.

    var chartType = document.getElementById("chartType");
            chartType.addEventListener( "change", function(){
            chart.options.data[0].type = chartType.options[chartType.selectedIndex].value;
            chart.render();
    });

    Please take a look at this JSFiddle for the complete code.

    Chart with dropdown to change chart type

    Considering this thread as a duplicate of using drop down how to change charts using user input value and hence closing the same.

    —-
    Manoj Mohan
    Team CanvasJS

    @gowri,

    There are couple of issue with the code that you have shared.

    1. You need to replace chartType with chart in chartType.options.data[0].type as chartType is referred to dropdown field not the chart object.
    chart.options.data[0].type = chartType.options[chartType.selectedIndex].value;

    2. Below code has to be inside the window.onload function as chart is inside window.onload scope.

    var chartType = document.getElementById("chartType");
            chartType.addEventListener( "change", function(){
            chart.options.data[0].type = chartType.options[chartType.selectedIndex].value;
            chart.render();
    });

    Please take a look at this JSFiddle for the complete code.

    Chart with dropdown to change chart type

    —-
    Manoj Mohan
    Team CanvasJS

    in reply to: using drop down how to change charts using user input value #26323

    @gowri,

    Please take a look at this JSFiddle to change chart type based on the value selected from the dropdown. Similarly, you can change chart options based on selected value from the dropdown.

    —-
    Manoj Mohan
    Team CanvasJS

Viewing 15 posts - 676 through 690 (of 807 total)