Skip to content

Commit b3cfc66

Browse files
committed
Implemented boost module. (Only the chart level options, have not implemented at the series level yet).
1 parent 0b05d16 commit b3cfc66

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

DotNet.Highcharts/DotNet.Highcharts/DotNet.Highcharts.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
<Compile Include="JsonSerializer.cs">
109109
<SubType>Code</SubType>
110110
</Compile>
111+
<Compile Include="Options\Boost\Boost.cs" />
112+
<Compile Include="Options\Boost\BoostDebug.cs" />
111113
<Compile Include="Options\Chart.cs" />
112114
<Compile Include="Options\ChartEvents.cs" />
113115
<Compile Include="Options\ChartResetZoomButton.cs" />

DotNet.Highcharts/DotNet.Highcharts/Helpers/Animation.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,17 @@ public class AnimationConfig
3131
/// </summary>
3232
/// <see cref="http://www.highcharts.com/ref/#chart--animation"/>
3333
public EasingTypes? Easing { get; set; }
34+
35+
/// <summary>
36+
/// A callback function to exectute when the animation finishes.
37+
/// </summary>
38+
[JsonFormatter("{0}")]
39+
public string Complete { get; set; }
40+
41+
/// <summary>
42+
/// A callback function to execute on each step of each attribute or CSS property that's being animated. The first argument contains information about the animation and progress.
43+
/// </summary>
44+
[JsonFormatter("{0}")]
45+
public string Step { get; set; }
3446
}
3547
}

DotNet.Highcharts/DotNet.Highcharts/Highcharts.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Collections.Generic;
1212
using System.Text;
1313
using System.Web;
14+
using DotNet.Highcharts.Options.Boost;
1415

1516
namespace DotNet.Highcharts
1617
{
@@ -31,6 +32,7 @@ public class Highcharts : IHtmlString
3132
internal ContainerOptions ContainerOptions { get; private set; }
3233

3334
private Accessibility _accessibility;
35+
private Boost _boost;
3436
private Chart _chart;
3537
private HighchartsData _data;
3638
private Credits _credits;
@@ -103,6 +105,17 @@ public Highcharts SetAccessibility(Accessibility accessibility)
103105
return this;
104106
}
105107

108+
/// <summary>
109+
/// Options regarding boost. Using boost enables WebGL rendering instead of the default Javascript rendering.
110+
/// </summary>
111+
/// <param name="boost"></param>
112+
/// <returns></returns>
113+
public Highcharts SetBoost(Boost boost)
114+
{
115+
_boost = boost;
116+
return this;
117+
}
118+
106119
/// <summary>
107120
/// Highchart by default puts a credits label in the lower right corner of the chart.
108121
/// This can be changed using these options.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using DotNet.Highcharts.Helpers;
6+
7+
namespace DotNet.Highcharts.Options.Boost
8+
{
9+
/// <summary>
10+
/// Options for the Boost module. The Boost module allows certain series types to be rendered by WebGL instead of the default SVG. This allows hundreds of thousands of data points to be rendered in milliseconds. In addition to the WebGL rendering it saves time by skipping processing and inspection of the data wherever possible. This introduces some limitations to what features are available in Boost mode. See the docs for details.
11+
/// In addition to the global boost option, each series has a boostThreshold that defines when the boost should kick in.
12+
/// Requires the modules/boost.js module.
13+
/// </summary>
14+
public class Boost
15+
{
16+
17+
/// <summary>
18+
/// If set to true, the whole chart will be boosted if one of the series crosses its threshold, and all the series can be boosted.
19+
/// Default: true
20+
/// </summary>
21+
public bool? AllowForce { get; set; }
22+
23+
/// <summary>
24+
/// Debugging options for boost. Useful for benchmarking, and general timing.
25+
/// </summary>
26+
public BoostDebug Debug { get; set; }
27+
28+
/// <summary>
29+
/// Enable or disable boost on a chart.
30+
/// Default: true
31+
/// </summary>
32+
public bool? Enabled { get; set; }
33+
34+
/// <summary>
35+
/// Set the series threshold for when the boost should kick in globally.
36+
/// Setting to e.g. 20 will cause the whole chart to enter boost mode if there are 20 or more series active. When the chart is in boost mode, every series in it will be rendered to a common canvas. This offers a significant speed improvment in charts with a very high amount of series.
37+
/// Default: null
38+
/// </summary>
39+
public Number? SeriesThreshold { get; set; }
40+
41+
/// <summary>
42+
/// Enable or disable GPU translations. GPU translations are faster than doing the translation in JavaScript.
43+
/// This option may cause rendering issues with certain datasets. Namely, if your dataset has large numbers with small increments (such as timestamps), it won't work correctly. This is due to floating point precission.
44+
/// Default: false
45+
/// </summary>
46+
// ReSharper disable once InconsistentNaming
47+
public bool? UseGPUTranslations { get; set; }
48+
}
49+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace DotNet.Highcharts.Options.Boost
7+
{
8+
/// <summary>
9+
/// Debugging options for boost. Useful for benchmarking, and general timing.
10+
/// </summary>
11+
public class BoostDebug
12+
{
13+
/// <summary>
14+
/// Show the number of points skipped through culling.
15+
/// When set to true, the number of points skipped in series processing is outputted. Points are skipped if they are closer than 1 pixel from each other.
16+
/// Default: false
17+
/// </summary>
18+
public bool? ShowSkipSummary { get; set; }
19+
20+
/// <summary>
21+
/// Time the WebGL to SVG buffer copy
22+
/// After rendering, the result is copied to an image which is injected into the SVG.
23+
/// If this property is set to true, the time it takes for the buffer copy to complete is outputted.
24+
/// Default: false
25+
/// </summary>
26+
public bool? TimeBuggerCopy { get; set; }
27+
28+
29+
// ReSharper disable once InconsistentNaming
30+
/// <summary>
31+
/// Time the building of the k-d tree.
32+
/// This outputs the time spent building the k-d tree used for markers etc.
33+
/// Note that the k-d tree is built async, and runs post-rendering. Following, it does not affect the performance of the rendering itself.
34+
/// Default: false
35+
/// </summary>
36+
public bool? TimeKDTRee { get; set; }
37+
38+
/// <summary>
39+
/// Time the series rendering.
40+
/// This outputs the time spent on actual rendering in the console when set to true.
41+
/// Default: false
42+
/// </summary>
43+
public bool? TimeRendering { get; set; }
44+
45+
/// <summary>
46+
/// Time the series processing.
47+
/// This outputs the time spent on transforming the series data to vertex buffers when set to true.
48+
/// Default: false
49+
/// </summary>
50+
public bool? TimeSeriesProcessing { get; set; }
51+
52+
/// <summary>
53+
/// Time the the WebGL setup.
54+
/// This outputs the time spent on setting up the WebGL context, creating shaders, and textures.
55+
/// Default: false
56+
/// </summary>
57+
public bool? TimeSetup { get; set; }
58+
}
59+
}

0 commit comments

Comments
 (0)