m7v
4/2/2014 - 9:22 AM

Create beautiful schedule via dx.chartjs.

Create beautiful schedule via dx.chartjs.

      var elementCount = Drupal.settings.spaint.graphics.users.length;
      var range = elementCount-1;
      var dataSource = [];
      for (var count = 0; count < elementCount; count++, range--) {
        var item = {
          breed: Drupal.settings.spaint.graphics.legendDate[range],
          tracks: Drupal.settings.spaint.graphics.tracks[range],
          users: Drupal.settings.spaint.graphics.users[range]
        };
        dataSource.push(item);
      }

      $("#graphicsContainerUserTracks").dxChart({
        dataSource: dataSource,
        title: "New Users and Tracks",
        equalBarWidth: false,
        commonSeriesSettings: {
          argumentField: "breed"
        },
        series: [
          {
            type: "line",
            valueField: "tracks",
            name: Drupal.t("New Tracks")
          },
          {
            type: "line",
            valueField: "users",
            name: Drupal.t("New Users")
          }
        ],
        legend: {
          verticalAlignment: "bottom",
          horizontalAlignment: "center",
          itemTextPosition: "right"
        },
        tooltip: {
          enabled: true,
          customizeText: function () {
            return 'Total ' + this.valueText;
          }
        }
      });