Skip to content

Instantly share code, notes, and snippets.

@induprasad
induprasad / LCMP_StrikeChart.cmp
Last active May 3, 2018 12:56
Lightning component for forming Chart
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes" access="global" >
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<ltng:require scripts="/resource/StrikeCmpResource" afterScriptsLoaded="{!c.onInit}"/>
<aura:attribute name="scriptsLoaded" type="Boolean" default="{!false}"/>
<aura:attribute name="chartRendered" type="Boolean" default="{!false}" description="Flag to display the loading spinner."/>
<aura:attribute name="triggerRedraw" type="Boolean" access="private" default="{!false}" description="Flag that triggers redraw of the chart."/>
<aura:attribute name="displayAxis" type="Boolean" access="private" default="{!false}" description="Flag that triggers displaying the left and bottom axis labels."/>
@induprasad
induprasad / LCC_CaseResults
Created April 24, 2018 08:21
Apex class to retrieve cases, accounts and their status
global without sharing class LCC_CaseResults {
@AuraEnabled
public static List<CaseViewResults> getAllCases() {
LIST<Case> filteredCases = new LIST<Case>();
LIST<Account> filteredAccounts = new LIST<Account>();
LIST<CaseViewResults> results = new LIST<CaseViewResults>();
Map<String, Case> recordSet = new Map<String, Case>();
SET<String> accountIds = new SET<String>();
@induprasad
induprasad / strikecmp.js
Created April 24, 2018 07:27
JS file required to be uploaded as static resource for using the strike chart component
// https://d3js.org Version 4.2.6. Copyright 2016 Mike Bostock.
(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})})(this,function(t){"use strict";function n(t){return function(n,e){return ms(t(n),e)}}function e(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Rs?i*=10:o>=Us?i*=5:o>=Ds&&(i*=2),n<t?-i:i}function r(t){return t.length}function i(){}function o(t,n){var e=new i;if(t instanceof i)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,o=-1,u=t.length;if(null==n)for(;++o<u;)e.set(o,t[o]);else for(;++o<u;)e.set(n(r=t[o],o,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}function u(){return{}}function a(t,n,e){t[n]=e}function c(){return o()}function s(t,n,e){t.set(n,e)}function f(){}function l(t,n){var e=new f;if(t instanceof f)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else