4

I'm trying to make a graph that displays some Vibration data. I'm using angular and chartjs.

I declared my labels (512 entries) I declared my data (512 entries)

and

$scope.datasetOverride2 = [{ xAxisID: 'x-axis-1', yAxisID: 'y-axis-1'  }];
$scope.options2 = {
      scales: {
        yAxes: [
          {
            id: 'y-axis-1',
            type: 'linear',
            display: true,
            position: 'left'
          }
        ],
        xAxes: [{
          id: 'x-axis-1',
          type: 'linear',
          scaleLabel: {
            display: true,
            labelString: 'Hz',
            fontStyle: 'bold'
          },
          ticks: {
            min: -1945.4,
            max: 1953,
            callback: function (value, index, values) {
              return parseFloat(value).toFixed(1);
            },
            autoSkip: true
          }
        }]
      }
    };

If I remove my xAxes configuration, my graph shows but with the labels I specified. enter image description here Instead, I aim to hide those labels and make the config do the xAxis job by setting the min, max... Like the following picture, but my data is not being displayed. enter image description here What am I missing?

1 Answer 1

1

Pay attention when using linear axis configuration, so data are points identified by a couple {x, y} like below:

$scope.data = [
    [
        { x: 0, y: 20 }, 
        { x: 1, y: 22 }, 
        { x: 2, y: 30 }, 
        { x: 3, y: 5 }, 
        ...
    ],

Check my working example: https://jsfiddle.net/beaver71/7sbchj9n/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.