You need to sign in to do that
Don't have an account?
scottskiblack
Dashboard S-Control
What versions of Dojo does SFDC support?
Is there a way to use the graphs (bar charts, stacked, etc) that Salesforce reporting already uses?
I am looking for the lightest way to create a dashboard with an s-control using Dojo or SFDC API...
Is there a way to use the graphs (bar charts, stacked, etc) that Salesforce reporting already uses?
I am looking for the lightest way to create a dashboard with an s-control using Dojo or SFDC API...
You can use the chat widget from dojo in sfdc.
<script type="text/javascript" src="/js/dojo/0.3.1/dojo.js"></script>
As well as using the charting require from dojo and so on.
dojo.require("dojo.widget.Tooltip");
I am using the Ajax ToolKit but it keeps utilizing Dojo 3.1 which I didn't think covered Charts yet? Only 4.1 and above, but I may be wrong. What versions of Dojo does SFDC support, can I just change the numbers in the src to the later version? -----> <script type="text/javascript" src="/js/dojo/0.4.1/dojo.js"></script>
I tried to use the 3.1 version of DOJO in SFDC. but I get the following error on a simple chart example.
FATAL: Could not load 'dojo.collections.Store'; last tried '__package__.js'
When I try to use 4.1 nothing happens at all.
Just in case I am missing something or going about it wrong the code is below.
<html>
<!--
Generated by AJAX tools
Date : Tue May 29 2007 08:36:32 GMT-0500 (Central Daylight Time)
Template : simple.html by manoj@cheenath.com
SControl : dojo_chart
-->
<head>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>
<script src="/soap/ajax/8.0/apex.js"></script>
<script type="text/javascript">
//Include the required dojo libraries/namespaces
dojo.require("dojo.collections.Store");
dojo.require("dojo.charting.Chart");
dojo.require('dojo.json');
</script>
<script type="text/javascript">
dojo.addOnLoad(function() {
// define the graph
var exampleData =
[
{ time: 10, count: 7382 },
{ time: 20, count: 1852 },
{ time: 35, count: 2397 },
{ time: 50, count: 1442 },
{ time: 55, count: 1854 }
];
var store = new dojo.collections.Store();
store.setData(exampleData);
var timeSeries = new dojo.charting.Series({
dataSource: store,
bindings: { x: "time", y: "count" },
label: "Example Series"
});
// next axis definitions to specify data display range, data source, tick labels
// Define the x-axis
var xAxis = new dojo.charting.Axis();
//Set the upper and lower data range values
xAxis.range = { lower: exampleData[0].time, upper: exampleData[exampleData.length-1].time };
xAxis.origin = "max";
xAxis.showTicks = true;
xAxis.label = "Example chart";
//Setup the x tick marks on the chart
xAxis.labels = [
{ label: 'First', value: 20 },
{ label: 'Second', value: 25 },
{ label: 'Third', value: 35 },
{ label: 'Fourth', value: 50 },
{ label: 'Fifth', value: 55 }
];
//Define the y-axis
var yAxis = new dojo.charting.Axis();
yAxis.range = { lower: 0, upper: 5000 };
yAxis.showLines = true;
yAxis.showTicks = true;
yAxis.label = "Time Taken";
//Setup the y tick marks on the chart
yAxis.labels = [
{ label: "0s", value: 0 },
{ label: "1s", value: 1000 },
{ label: "2s", value: 2000 },
{ label: "3s", value: 3000 },
{ label: "4s", value: 4000 },
{ label: "5s", value: 5000 }
];
// define how to plot by assign series with a plotter to render
var chartPlot = new dojo.charting.Plot(xAxis, yAxis);
chartPlot.addSeries({
data: timeSeries,
plotter: dojo.charting.Plotters.CurvedArea
});
// this needs to be rendered into a specific area, so define PlotArea and add plot
var chartPlotArea = new dojo.charting.PlotArea();
chartPlotArea.size = { width: 380, height: 170 };
chartPlotArea.padding = { top: 20, right: 20, bottom: 30, left: 50 };
//Add the plot to the area
chartPlotArea.plots.push(chartPlot);
// finally create chart and add the plotarea. THE CHART ALSO NEEDS a container element, which
// one assigns to the chart.node
var chart = new dojo.charting.Chart(null, "Example chart", "This is the example chart description");
//Add the plot area at an offset of 10 pixels from the top left
chart.addPlotArea({ x: 10, y: 10, plotArea: chartPlotArea });
//Setup the chart to be added to the DOM on load
dojo.addOnLoad(function()
{
chart.node = dojo.byId("GraphContainerArea");
chart.render();
});
}
</script>
</head>
<body>
Body of the scontrol here
</body>
</html>
Code: