-
Notifications
You must be signed in to change notification settings - Fork 20
/
DateAxis3DView.m
114 lines (101 loc) · 3.77 KB
/
DateAxis3DView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// DateAxis3DView.m is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
#import "DateAxis3DView.h"
int Temperatures[7][24] = {
// day 1
{
8, 8, 7, 7, 6, 6, 6, 6,
6, 6, 6, 7, 7, 7, 8, 9,
9, 10, 10, 10, 10, 10, 9, 9
},
// day 2
{
9, 7, 7, 7, 6, 6, 6, 6,
7, 7, 8, 9, 9, 12, 15, 16,
16, 16, 17, 16, 15, 13, 12, 11,
},
// day 3
{
11, 10, 9, 11, 7, 7, 7, 9,
11, 13, 15, 16, 17, 18, 17, 18,
19, 19, 18, 10, 10, 11, 10, 10
},
// day 4
{
11, 10, 11, 10, 11, 10, 10, 11,
11, 13, 13, 13, 15, 15, 15, 16,
17, 18, 17, 17, 15, 13, 12, 11
},
// day 5
{
13, 14, 12, 12, 11, 12, 12, 12,
13, 15, 17, 18, 20, 21, 21, 22,
22, 21, 20, 19, 17, 16, 15, 16
},
// day 6
{
16, 16, 16, 15, 14, 14, 14, 12,
13, 13, 14, 14, 13, 15, 15, 15,
15, 15, 14, 15, 15, 14, 14, 14
},
// day 7
{
14, 15, 14, 13, 14, 13, 13, 14,
14, 16, 18, 17, 16, 18, 20, 19,
16, 16, 16, 16, 15, 14, 13, 12
}
};
@implementation DateAxis3DView
- (void)initExample {
SCIDateAxis3D *xAxis = [SCIDateAxis3D new];
xAxis.subDayTextFormatting = @"HH:mm";
xAxis.maxAutoTicks = 8;
SCINumericAxis3D *yAxis = [SCINumericAxis3D new];
yAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.0 max:0.1];
SCIDateAxis3D *zAxis = [SCIDateAxis3D new];
zAxis.textFormatting = @"dd MMM";
zAxis.maxAutoTicks = 8;
const int daysCount = 7;
const int measurementsCount = 24;
SCIWaterfallDataSeries3D *ds = [[SCIWaterfallDataSeries3D alloc] initWithXType:SCIDataType_Date yType:SCIDataType_Double zType:SCIDataType_Date xSize:measurementsCount zSize:daysCount];
ds.startX = [NSDate dateWithYear:2019 month:5 day:1];
ds.stepX = [[NSDate alloc] initWithTimeIntervalSince1970:[SCIDateIntervalUtil fromMinutes:30]];
ds.startZ = [NSDate dateWithYear:2019 month:5 day:1];
ds.stepZ = [[NSDate alloc] initWithTimeIntervalSince1970:[SCIDateIntervalUtil fromDays:1]];
for (int z = 0; z < daysCount; ++z) {
int *templeratures = Temperatures[z];
for (int x = 0; x < measurementsCount; ++x) {
[ds updateYValue:@(templeratures[x]) atXIndex:x zIndex:z];
}
}
unsigned int colors[5] = { 0xFFFF0000, 0xFFFFA500, 0xFFFFFF00, 0xFFADFF2F, 0xFF006400 };
float stops[5] = { 0.f, 0.25f, 0.5f, 0.75f, 1.0f};
SCIGradientColorPalette *palette = [[SCIGradientColorPalette alloc] initWithColors:colors stops:stops count:5];
SCIWaterfallRenderableSeries3D *rs = [SCIWaterfallRenderableSeries3D new];
rs.dataSeries = ds;
rs.stroke = 0xFF0000FF;
rs.strokeThickness = 1.0;
rs.sliceThickness = 2.0;
rs.yColorMapping = palette;
[SCIUpdateSuspender usingWithSuspendable:self.surface withBlock:^{
self.surface.xAxis = xAxis;
self.surface.yAxis = yAxis;
self.surface.zAxis = zAxis;
[self.surface.renderableSeries add:rs];
[self.surface.chartModifiers add:ExampleViewBase.createDefault3DModifiers];
}];
}
@end