I've been working on a project that involves using the Syncfusion Javascript gauge control to show a weekly pay bonus. The data for this is stored in a SharePoint list, and I have written a JavaScript code to convert the SharePoint list from XML to JSON.
<script type="text/javascript">
$ajax({
url: "/_api/web/lists/GetByTitle('bonusEntry')/items?$orderby=Date desc&$filter=Department eq 'Meltshop'&$top=1",
type: "GET",
headers: {
"accept":"application/json;odata=verbose",
},
success: function (data) {
var newMsBonus = "";
for(i=0; i < data.d.results.length; i++){
newMsBonus = newMsBonus + "<div>" + data.d.results[i].ACrew + "</div>";
}
$('#oDataanalysisScoreBoard').html(newMsBonus);
},
error: function (error) {
alert("error: " + JSON.stringify(error));
}
})
Following this, the value retrieved is placed in this specific Div.
<div id="oDataanalysisScoreBoard"></div>
My main goal is to bind this data to the Syncfusion control setup as shown below:
$("#CircularGauge1").ejCircularGauge({
width: 500,
height: 500,
backgroundColor: "#3D3F3D",
readOnly: false,
scales: [{
ticks: [{
type: "major",
distanceFromScale: 70,
height: 20,
width: 3,
color: "#ffffff"
}, {
type: "minor",
height: 12,
width: 1,
distanceFromScale: 70,
color: "#ffffff"
}],
}]
});
The gauge itself is created within this container:
<div id="CircularGauge1"></div>
Even though the gauge is successfully built, I'm facing issues with passing the value to it.
If anyone has any suggestions or insights on how I can resolve this issue or if there are any improvements I can make, your feedback would be greatly appreciated! Thank you all! EDIT: The Syncfusion software generates a gauge and adjusts the needle according to a numerical input. My AJAX call fetches a number from a SharePoint list and displays it in a div.