Embed Kendo UI Chart

Hi,

Attempting to embed a KendoUI Chart in a Template component. I’ve added the KendoUI Static Resource. Not sure how to properly code a Inline JavaScript snippet.

Here’s the VF Page code that I am trying to replicate in Skuid:

<apex:page > 
<head>
 <apex:stylesheet value="{!URLFOR($Resource.KendoUI, '/styles/kendo.common.min.css')}"/>
 <apex:stylesheet value="{!URLFOR($Resource.KendoUI, '/styles/kendo.default.min.css')}" />
 <apex:stylesheet value="{!URLFOR($Resource.KendoUI, '/styles/kendo.dataviz.min.css')}" />
 <apex:stylesheet value="{!URLFOR($Resource.KendoUI, '/styles/kendo.dataviz.default.min.css')}" />
 
 <apex:includeScript value="{!URLFOR($Resource.KendoUI, '/js/jquery.min.js')}"/>
 <apex:includeScript value="{!URLFOR($Resource.KendoUI, '/js/kendo.all.min.js')}"/>
 <apex:includeScript value="{!URLFOR($Resource.KendoUI, '/js/angular.min.js')}"/>
</head>
<body> 
 <div id="chart"></div>
 <script>
 function createChart() {
 $("#chart").kendoChart({
 title: {
 text: "Job Growth for 2011"
 },
 legend: {
 visible: false
 },
 seriesDefaults: {
 type: "bubble"
 },
 series: [{
 data: [{
 x: -2500,
 y: 50000,
 size: 500000,
 category: "Microsoft"
 }, {
 x: 500,
 y: 110000,
 size: 7600000,
 category: "Starbucks"
 }, {
 x: 7000,
 y: 19000,
 size: 700000,
 category: "Google"
 }, {
 x: 1400,
 y: 150000,
 size: 700000,
 category: "Publix Super Markets"
 }, {
 x: 2400,
 y: 30000,
 size: 300000,
 category: "PricewaterhouseCoopers"
 }, {
 x: 2450,
 y: 34000,
 size: 90000,
 category: "Cisco"
 }, {
 x: 2700,
 y: 34000,
 size: 400000,
 category: "Accenture"
 }, {
 x: 2900,
 y: 40000,
 size: 450000,
 category: "Deloitte"
 }, {
 x: 3000,
 y: 55000,
 size: 900000,
 category: "Whole Foods Market"
 }]
 }],
 xAxis: {
 labels: {
 format: "{0:N0}",
 skip: 1
 },
 axisCrossingValue: -5000,
 majorUnit: 2000,
 plotBands: [{
 from: -5000,
 to: 0,
 color: "#00f",
 opacity: 0.05
 }]
 },
 yAxis: {
 labels: {
 format: "{0:N0}"
 },
 line: {
 width: 0
 }
 },
 tooltip: {
 visible: true,
 format: "{3}: {2:N0} applications",
 opacity: 1
 }
 });
 }
 $(document).ready(createChart); </script>
</body>
</apex:page>
Any help would be appreciated. Regards, Irvin

There are two strategies that could be used here. 

1. You could wrap the VF page in an iFrame in the template component.   Don’t change your VF code - just call it from the iFrame. 

2. You could take the contents of your VF page and adjust them so tehy are Javascript resources in your skuid page.  

A: Each referenced resource in the script above would need to be resources called from the Static Resource.  (See this help file:  http://help.skuidify.com/m/supercharge-your-ui/l/102514-including-custom-javascript-in-a-skuid-page

B: The script statement in the VF page would become a Inline Javascript resource. 

C: Finally - a template component would be used to actually put the “Chart” div on the page. 

See this forum post where Glenn Elliott outines his strategy for including Kendo charts on Skuid pages.   https://community.skuidify.com/skuid/topics/google_charts_in_skuid_template  (I know it says Google Charts - but Glenn describes his Kendo Strategy in some detail). 


Hi Rob,

First, thanks for the timely response. Very much appreciated.

I prefer option 2. What is not clear to me is whether Skuid can support ZIP file static resources? Glen’s post seems to indicate Skuid does whereas your comment seems to indicate that Skuid does not. The online documentation is a little ambiguous.

So that I am clear, I will need to add a static resource for each and every JS and CSS file and it must be uncompressed?

Here’s the error I get when referencing the Kendo UI library currently as a ZIP-ed file static resource.


Here’s the screenshot of the static resource definition:

Here’s my snippet:

skuid.$(function() { skuid.$('#perfTab').on('tabshow', function(e, data){ console.log('KendoUI ...'); function createChart() { skuid.$("#chart-incremental-revenue").kendoChart({ title: { text: "Incremental Revenue", align: "center", position: "top", visible: true }, legend: { visible: false }, series: [{ type: "bullet", currentField: "current", targetField: "target", data: [ { current: 127500, target: 135000} ] }], categoryAxis: { majorGridLines: { visible: false }, majorTicks: { visible: false } }, valueAxis: [{ plotBands: [{ from: 100000, to: 120000, color: "red", opacity: .3 }, { from: 120000, to: 135000, color: "orange", opacity: .3 }, { from: 135000, to: 150000, color: "green", opacity: .3 }], majorGridLines: { visible: false }, min: 100000, max: 150000, minorTicks: { visible: true } }], tooltip: { visible: true, shared: true, template: "Current: #= value.current # 
 Prescribed: #= 150000 # 
 Proposed: #= value.target # 
 Target: #= 135000 #" } }); } setTimeout(function() { // Initialize the chart with a delay to make sure // the initial animation is visible createChart(); }, 400); }); }); 

My issue was not understanding how to properly define static resources in Skuid that were saved in Salesforce as a ZIP file. Yeah, I was a little slow but figured it out. Kendo UI charts are working nicely.

Glad to hear!  Would you mind posting a picture of what your finished page looks like?  We love to see some of these more advanced use cases…

Here you go:

Looks great!

Worth keeping an eye on this, though: https://community.skuidify.com/skuid/topics/wow-winter-15-skuid-sneak-peak

Yep, waiting for the Skuid bits.