API/CodeSamples/CustomizeChartDelegate.md
... ...
@@ -0,0 +1,63 @@
1
+#CustomizeChartDelegate
2
+
3
+[[_TOC_]]
4
+
5
+##About
6
+
7
+Represents a method that runs before chart reports get run. This applies to all charts except visualizations.
8
+
9
+**Default Value:** null
10
+
11
+##Global.asax (C♯)
12
+
13
+```csharp
14
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
15
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
16
+{
17
+ // Configure settings
18
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
19
+ public static void InitializeReporting() {
20
+ //Check to see if we've already initialized.
21
+ if (AdHocContext.Initialized)
22
+ return;
23
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
24
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
25
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
26
+ AdHocSettings.CustomizeChartDelegate = CustomizeChart; //The relevant setting
27
+ AdHocContext.Initialized = true;
28
+ }
29
+
30
+ //delegate method
31
+ private static void CustomizeChart(object chart)
32
+ {
33
+ //TODO: Customize chart logic
34
+ }
35
+}
36
+```
37
+
38
+##Global.asax (VB.NET)
39
+
40
+```visualbasic
41
+
42
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
43
+Public Class CustomAdHocConfig
44
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
45
+
46
+ Shared Sub InitializeReporting()
47
+ 'Check to see if we've already initialized
48
+ If AdHocContext.Initialized Then
49
+ Return
50
+ 'Initialize System
51
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
52
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
53
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
54
+ AdHocSettings.CustomizeChartDelegate = CustomizeChart 'The relevant setting
55
+ AdHocContext.Initialized = True
56
+ End Sub
57
+
58
+ 'Delegate Method
59
+ Private Shared Sub CustomizeChart(ByVal chart As Object)
60
+
61
+ End Sub
62
+End Class
63
+```
... ...
\ No newline at end of file