Hi, when using the SCIM API for fetching all the accounts, under console-network I get all the accounts in the IIQ instance, but they are not rendering in the chart.js graph:
const apiUrl = '{{baseUrl}}//scim/v2/Accounts';
async function fetchData() {
try {
const response = await fetch(apiUrl, {
method: 'GET',
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching data from SCIM API:', error);
throw error;
}
}
async function createChart() {
try {
const data = await fetchData();
if (Array.isArray(data.accounts)) {
const accounts = data.accounts;
const accountCount = accounts.length;
const ctx = document.getElementById('lineChartAccounts').getContext('2d');
new Chart(ctx, {
type: 'line',
data: {
labels: ['Account Count'],
datasets: [{
label: 'Account Count',
data: [accountCount],
borderColor: 'blue',
fill: false,
}]
},
options: {
responsive: false,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Account Count',
},
},
x: {
title: {
display: true,
text: 'Account Count',
},
},
},
},
});
}
} catch (error) {
console.error('Error creating the chart:', error);
}
}
document.addEventListener('DOMContentLoaded', function () {
createChart();
});
<div class="linechart" style="height: 300px; width: auto;">
<canvas id="lineChartAccounts"></canvas>
<script src="/accountsStatus.js"></script>
</div>
I get no error messages, the accounts are returned with a 200 status code but the canvas is blank: