Histograms - First time both plotly and js

Hello !

I’m trying both Plot.ly and Javascript for the first time, in ASP.NET context, and i have a few difficulties.

I’m mostly using this exemple as reference.

Here is my try :

<div id="TestChart"></div>

<script type="text/javascript" src="https://cdn.plot.ly/plotly-laQueryList.min.js"></script>

<script type="text/javascript">
        var x = [];
        var y = [];
        var source = <%= SerializedRecords %>;

       var data = [
               x: Object.keys(source),
               y: Object.values(source),
               name: 'number',
               histnorm: "count",
               type: 'histogram',
               marker: {
                 color: 'rgba(100,250,100,0.7)',
       Plotly.newPlot('TestChart', data);  

SerializedRecords is a code-behind string that received a JSON-serialized List.
I got many problems with this.

First, i got a syntax error on the third semi-colon, did i miss something in the JS syntax ??
Second, it warns me that global variable Plotly may be not assigned, how to be sure it is ?
Third, is it the correct way to make an histogram with plotly ??

Thank you in advance for your advice.

This is probably not the best place to get beginner JS help. I’d recommend http://stackoverflow.com/

Your plotly attributes look ok, but without knowing the structure of your source object, it’s hard to help you out more.

It seems the CDN link return a 403 Access Denied error, which was causing the issue. Will try with a local version of plotly-latest.min.js. About source object, it’s 4 properties in a C# class, serialized with .NET System.Web.Script.Serialization.Javascriptserializer.