Scatter plot

The DailyWeather database has data by month, day, city and temperature. In this example we plot a scatter plot of temperature of the city of Boston w.r.t month.

Points to note:

  • Notice that the data is filtered naturally using filter method in django.

code

ds = DataPool(
       series=
        [{'options': {
            'source': DailyWeather.objects.filter(city="Boston")},
          'terms': [
            'month', 
            'temperature']}])

cht = Chart(
        datasource = ds, 
        series_options = 
          [{'options':{
              'type': 'scatter'},
            'terms':{
              'month': [
                'temperature']
              }}],
        chart_options = 
          {'title': {
               'text': 'Boston weather scatter plot'},
           'xAxis': {
                'title': {
                   'text': 'Month'}}})