10 #ifndef EMP_D3_SCALES_H 11 #define EMP_D3_SCALES_H 16 #include "../js_utils.h" 37 template <
typename T,
size_t SIZE>
40 EM_ASM_ARGS({js.objects[$0].range(emp_i.__incoming_array);}, this->
id);
45 EM_ASM_ARGS({js.objects[$0].range([$1, $2]);}, this->
id, min, max);
51 template <
typename T,
size_t SIZE>
54 EM_ASM_ARGS({js.objects[$0].domain(emp_i.__incoming_array);}, this->
id);
59 EM_ASM_ARGS({js.objects[$0].domain([$1, $2]);}, this->
id, min, max);
65 int new_id = EM_ASM_INT_V({
return js.objects.next_id++});
67 js.objects[$1] = js.objects[$0].copy();
75 return EM_ASM_DOUBLE({
return js.objects[$0]($1);},this->
id, input);
79 return EM_ASM_INT({
return js.objects[$0]($1);},this->
id, input);
95 return EM_ASM_DOUBLE({
return js.objects[$0].invertExtent($1);},
110 EM_ASM_ARGS({js.objects[$0] = d3.scaleThreshold()}, this->
id);
118 EM_ASM_ARGS({js.objects[$0] = d3.scaleIdentity();}, this->
id);
123 template <
typename T>
125 return EM_ASM_DOUBLE({
return js.objects[$0].invert($1);}, this->
id, y);
129 EM_ASM_ARGS({js.objects[$0].ticks($1);}, this->
id, count);
136 EM_ASM_ARGS({js.objects[$0].tick($1, Pointer_stringify($2));},
137 this->
id, count, format.c_str());
145 EM_ASM_ARGS({js.objects[$0] = d3.scaleLinear();}, this->
id);
150 template <
typename T,
size_t SIZE>
153 EM_ASM_ARGS({js.objects[$0].rangeRound(
emp.__incoming_array);}, this->
id);
158 EM_ASM_ARGS({js.objects[$0].rangeRound([$1, $2]);}, this->
id, min, max);
169 EM_ASM_ARGS({js.objects[$0].clamp($1);}, this->
id, clamp);
175 EM_ASM_ARGS({js.objects[$0].nice($1);}, this->
id, count);
177 EM_ASM_ARGS({js.objects[$0].nice();}, this->
id);
187 EM_ASM_ARGS({js.objects[$0] = d3.scaleLog();}, this->
id);
197 EM_ASM_ARGS({js.objects[$0] = d3.scalePow();}, this->
id);
203 EM_ASM_ARGS({js.objects[$0].exponent($1);}, this->
id, ex);
215 EM_ASM_ARGS({js.objects[$0] = d3.scaleTime();}, this->
id);
224 EM_ASM({js.objects[$0]= d3.scaleOrdinal();}, this->
id);
234 EM_ASM({js.objects[$0] = d3.scaleCategory10();}, this->
id);
241 EM_ASM({js.objects[$0] = d3.scaleCategory20();}, this->
id);
248 EM_ASM({js.objects[$0] = d3.scaleCategory20b();}, this->
id);
257 EM_ASM({js.objects[$0] = d3.scaleCategory20c();}, this->
id);
QuantileScale()
Definition: scales.h:102
LinearScale(bool derived)
Definition: scales.h:148
Category20bScale()
Definition: scales.h:247
LinearScale & Clamp(bool clamp)
Definition: scales.h:168
LinearScale & Nice(int count=-1)
Definition: scales.h:173
ThresholdScale()
Definition: scales.h:109
LinearScale & SetRangeRound(double min, double max)
Definition: scales.h:157
LinearScale & SetRangeRound(emp::array< T, SIZE > values)
Definition: scales.h:151
Category20cScale()
Definition: scales.h:256
Category20Scale()
Definition: scales.h:240
double InvertExtent(T y)
Definition: scales.h:94
double ApplyScale(double input)
Calculate the ouput for [input], based on the scale's scaling function.
Definition: scales.h:73
Scale & SetDomain(double min, double max)
Definition: scales.h:58
OrdinalScale(bool derived)
Definition: scales.h:227
PowScale SqrtScale()
Definition: scales.h:208
Scale & SetRange(emp::array< T, SIZE > values)
Definition: scales.h:38
Scale(bool derived)
Decoy constructor so we don't construct extra base scales.
Definition: scales.h:32
int id
Definition: scales.h:254
ThresholdScale(bool derived)
Definition: scales.h:112
TimeScale()
Definition: scales.h:214
int id
Definition: d3_init.h:45
Scale(int id)
Definition: scales.h:26
Scale & SetRange(double min, double max)
Definition: scales.h:44
QuantileScale(bool derived)
Definition: scales.h:103
PowScale & Exponent(double ex)
Definition: scales.h:202
double Invert(T y)
Definition: scales.h:124
TimeScale(bool derived)
Definition: scales.h:218
int ApplyScale(int input)
Definition: scales.h:78
IdentityScale & SetTickFormat(int count, std::string format)
Definition: scales.h:133
Scale Copy()
Make a copy of this scale.
Definition: scales.h:64
LogScale()
Definition: scales.h:186
Scale & SetDomain(emp::array< T, SIZE > values)
Definition: scales.h:52
If we are in emscripten, make sure to include the header.
Definition: array.h:37
IdentityScale()
Definition: scales.h:117
QuantizeScale()
Definition: scales.h:90
LinearScale & SetInterpolate(std::string factory)
Definition: scales.h:163
IdentityScale & SetTicks(int count)
Definition: scales.h:128
LogScale(bool derived)
Definition: scales.h:190
QuantizeScale(bool derived)
Definition: scales.h:91
#define D3_CALLBACK_METHOD_1_ARG(FUNC, ARG1)
Definition: utils.h:115
Category10Scale()
Definition: scales.h:233
LinearScale()
Definition: scales.h:144
PowScale()
Definition: scales.h:196
IdentityScale(bool derived)
Definition: scales.h:121
Scale()
Definition: scales.h:29
PowScale(bool derived)
Definition: scales.h:200
void pass_array_to_javascript(C values)
Definition: js_utils.h:212
OrdinalScale()
Definition: scales.h:223