javascript - how do you create highcharts bar chart -


i trying build bar chart using highcharts. function:

function monthly_web_login() {          $.getjson('monthly_web_login.php', function(data) {          var chart = new highcharts({          chart: {                 bordercolor: '#98afc7',                 borderradius: 20,                 borderwidth: 1,                 renderto: 'login',                 type: 'bar',                 marginright: 10,              },              exporting: {             enabled: true         },             rangeselector: {                 enabled:false                           },              scrollbar: {                     enabled: false                     },             navigator : {                 enabled : false             },             xaxis: {             type: 'datetime',             tickinterval: 30 * 24 * 3600 * 1000, // 6 months month             datetimelabelformats: {                 millisecond: '%h:%m:%s.%l',                 second: '%h:%m:%s',                 minute: '%h:%m',                 hour: '%h:%m',                 day: '%e. %b',                 week: '%e. %b',                 month: '%b',                 year: '%y'             }         },             yaxis: { // primary yaxis                 labels: {                     style: {                         color: 'blue'                     }                 },                 gridlinecolor: '#197f07',                 gridlinewidth: 0,                 title: {                     text: 'monthly logons',                     style: {                         color: 'blue'                     }                 }             },              credits: {                 enabled: false             },              title: {                 text: 'total monthly logons',                 style: {                     color: '#333000',                     fontsize: '14px'                 }             },              tooltip: {                 pointformat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y} </b><br>',                 valuedecimals: 2             },             series: data       });     }); } 

this json file:

[{"name":"logon","pointstart":date.utc(2011, 1, 1),"pointinterval":30 * 24 * 3600 * 1000,"data":[284697404,268944957,297847827,287150001,277779620,262275285]}] 

this html:

<div id="login" style="width:700px; height:300px;"></div> 

i dont see errors , no charts either. ideas, doing wrong here?

it doesn't appear you're associating chart dom element.

instead of:

var chart = new highcharts({})... 

try:

var chart = $('#login').highcharts({})... 

see jsfiddle (http://jsfiddle.net/pstcc/) working example using code minor modifications.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -