You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can anyone help me how to include or filter in below. for ecample I need to filter by custom properties i.e. comments = customxyz
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// The query we'll run against the web-based API
// If you use a multi-line query, use a backslash '\' to indicate the next line is part of the string (may cause browser issues)
// Alternatively, use a "+" to join the lines (preferred method)
var swql="SELECT CONCAT(SUBSTRING(TOSTRING(DATETRUNC('MONTH',DATETIME)),1,4),SUBSTRING(TOSTRING(DATETRUNC('MONTH',DATETIME)),8,4)) AS [Month]"
+ " , ROUND(AVG(Availability),2) AS [Average]"
+ ", TOSTRING(ROUND(AVG(Availability),2)) + '%' AS [Label]"
+ ", CASE"
+ " WHEN AVG(Availability) <= 85 THEN '#950000'"
+ " WHEN AVG(Availability) < 90 THEN '#FEC405'"
+ " ELSE '#B8D757'"
+ " END AS [State]"
+ " FROM Orion.ResponseTime"
+ " WHERE (YEARDIFF(DATETIME,(GETUTCDATE()))=0)"
+ " GROUP BY DATETRUNC('MONTH',DATETIME)"
+ " ORDER BY DATETRUNC('MONTH',DATETIME) ASC";
// Convert the above query into a single line and add any parameters (required by the SolarWinds Information Service, even if empty)
var dataToSendToSwis = JSON.stringify({
query: swql,
parameters: {}
});
// using jQuery make a call to the Orion Information Service
$.ajax({
type: 'POST',
url: '/Orion/Services/Information.asmx/QueryWithParameters',
data: dataToSendToSwis,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
console.log(response.d.Rows);
google.charts.load("current", {
packages: ['corechart']
});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
// Build a new dataTable to hold the results of the query
var dataTable = new google.visualization.DataTable();
// Define the headings
dataTable.addColumn({
type: 'string',
id: 'Month'
});
dataTable.addColumn({
type: 'number',
id: 'Average'
});
dataTable.addColumn({
type: 'string',
role: 'annotation'
});
dataTable.addColumn({
type: 'string',
role: 'style'
});
// Convert the results to a row and add them to the dataTable by cycleing through each record
for (var i = 0; i < response.d.Rows.length; i++) {
var row = [response.d.Rows[i][0], response.d.Rows[i][1], response.d.Rows[i][2], response.d.Rows[i][3]];
dataTable.addRow(row);
console.log(response.d.Rows);
} // end of datatable loop
// define the options (title, height in pixels, etc.)
var options = {
title: 'Monthly Availability (Last 6 Months)',
height: 450,
bars: 'vertical',
legend: {
position: "none"
},
}; //end of chart options
// the "columnchart_monthly" is the ID of the
element we'll be replacing
var chart = new google.visualization.ColumnChart(document.getElementById("columnchart_monthly"));
chart.draw(dataTable, options);
}
}
})
</script>
The text was updated successfully, but these errors were encountered:
can anyone help me how to include or filter in below. for ecample I need to filter by custom properties i.e. comments = customxyz
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // The query we'll run against the web-based API // If you use a multi-line query, use a backslash '\' to indicate the next line is part of the string (may cause browser issues) // Alternatively, use a "+" to join the lines (preferred method) var swql="SELECT CONCAT(SUBSTRING(TOSTRING(DATETRUNC('MONTH',DATETIME)),1,4),SUBSTRING(TOSTRING(DATETRUNC('MONTH',DATETIME)),8,4)) AS [Month]" + " , ROUND(AVG(Availability),2) AS [Average]" + ", TOSTRING(ROUND(AVG(Availability),2)) + '%' AS [Label]" + ", CASE" + " WHEN AVG(Availability) <= 85 THEN '#950000'" + " WHEN AVG(Availability) < 90 THEN '#FEC405'" + " ELSE '#B8D757'" + " END AS [State]" + " FROM Orion.ResponseTime" + " WHERE (YEARDIFF(DATETIME,(GETUTCDATE()))=0)" + " GROUP BY DATETRUNC('MONTH',DATETIME)" + " ORDER BY DATETRUNC('MONTH',DATETIME) ASC"; // Convert the above query into a single line and add any parameters (required by the SolarWinds Information Service, even if empty) var dataToSendToSwis = JSON.stringify({ query: swql, parameters: {} }); // using jQuery make a call to the Orion Information Service $.ajax({ type: 'POST', url: '/Orion/Services/Information.asmx/QueryWithParameters', data: dataToSendToSwis, contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { console.log(response.d.Rows); google.charts.load("current", { packages: ['corechart'] }); google.charts.setOnLoadCallback(drawChart); function drawChart() { // Build a new dataTable to hold the results of the query var dataTable = new google.visualization.DataTable(); // Define the headings dataTable.addColumn({ type: 'string', id: 'Month' }); dataTable.addColumn({ type: 'number', id: 'Average' }); dataTable.addColumn({ type: 'string', role: 'annotation' }); dataTable.addColumn({ type: 'string', role: 'style' }); // Convert the results to a row and add them to the dataTable by cycleing through each record for (var i = 0; i < response.d.Rows.length; i++) { var row = [response.d.Rows[i][0], response.d.Rows[i][1], response.d.Rows[i][2], response.d.Rows[i][3]]; dataTable.addRow(row); console.log(response.d.Rows); } // end of datatable loop // define the options (title, height in pixels, etc.) var options = { title: 'Monthly Availability (Last 6 Months)', height: 450, bars: 'vertical', legend: { position: "none" }, }; //end of chart options // the "columnchart_monthly" is the ID of theThe text was updated successfully, but these errors were encountered: