forked from benmarder/overdraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtry.html
325 lines (302 loc) · 16.9 KB
/
try.html
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="includes/style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
<script src="includes/d3.min.js"></script>
<script>
//------------------------------
.call(function(d){
alert(level);
if(level == 1){
$(".node").append("article")
.attr("class","description").html(function(d){
switch(d.nameEn){
case "Health":
return "ההוצאות על בריאות גדלות בהתמדה עם השנים, בעיקר בגלל שהישראלים קונים יותר ויותר ביטוחי בריאות, מה שמגדיל עוד יותר את ההוצאה על בריאות (כי אם כבר יש ביטוח, בואו נשתמש בו). עיקר ההוצאה הזו מתגלגל בסוף לכיס הרופאים";
break;
case "Clothing and footwear":
return "החלק היחסי של ההוצאה הזו יורד עם השנים, בעיקר בגלל ירידות מחירי הטקסטיל בישראל ובעולם. ככל שיותר בגדים מיוצרים במזרח, וככל שנכנסים לישראל יותר מותגים מחו״ל, כך המחירים יורדים";
break;
case "Food":
return "ההוצאה על מזון היא השלישית בגודל מבין ההוצאות של המשפחות בישראל. ככל שהמשפחה ענייה יותר, ועם יותר ילדים, כך החלק היחסי שהיא מוציאה על מזון מכלל ההוצאות שלה - גדול יותר. לכן, התייקרות מחירי המזון בשנים האחרונות פגעה בכולם, אבל באופן יחסי פגעה בעניים יותר";
break;
case "Miscellaneous goods and services":
break;
case "Education, culture and entertainment":
return "ההוצאה הרביעית בגודלה מקרב כלל ההוצאות. בעיקרון, הגודל היחסי של ההוצאה הזו פוחת עם השנים. אבל אם מסתכלים על הנתונים מקרוב, רואים שהחלק היחסי של ההוצאות על חינוך עולה. ככה זה כשההורים מרגישים שהמדינה לא נותנת מספיק, וקונים לילדים שלהם שיעורים פרטיים";
break;
case "Transport and communications":
return "ככל שמשפחה עשירה יותר, כך היא מוציאה יותר כסף על תחבורה ותקשורת. בגלל התגברות התחרות בענף הסלולר בשנתיים האחרונות, המחירים בקטגוריה זו הוזלו קצת, אבל עדיין מדובר בהוצאה השניה בגודלה אחרי ההוצאות על דיור";
break;
case "Housing, Dwelling and household maintenance":
return "זו ההוצאה הגדולה ביותר של המשפחות בישראל, שמהווה בממוצע רבע מכל ההוצאות שלהן. ככל שמחירי הדיור עולים, גם החלק של ההוצאה על דיור עולה";
}
})
// .on("mouseover",function(d){
// $(this).find(".description").css("display","block");
//})
//.on('mouseout',function(){
//$(this).find(".description").css("display","none");
//})
}
else{
d3.selectAll("article").remove();
}
})
// case "Health":
selected = health;
category = year.categories.health;
break;
case "Clothing and footwear":
selected = clothing;
category = year.categories.clothing_and_footwear;
break;
case "Food":
selected = food;
category = year.categories.food;
break;
case "Miscellaneous goods and services":
selected = miscellaneous;
category = year.categories.miscellaneous_goods_and_services;
break;
case "Education, culture and entertainment":
selected = education;
category = year.categories.education_culture_and_entertainment;
break;
case "Transport and communications":
selected = transport;
category = year.categories.transport_and_communications;
break;
case "Housing, Dwelling and household maintenance":
selected = housing;
category = year.categories.housing_dwelling_and
// ------------------------
$.getJSON("includes/Data Sets/2003-2011.json", function(data) {
//console.log(data.categories.housing.name_he);
// sample data array
var year2003=data.y2003;
var year=year2003;
var sample_data = [{
"value": year.categories.education_culture_entertainment.fifths[5],
"name": year.categories.education_culture_entertainment.name_he
}, {
"value": year.categories.food.fifths[5],
"name": year.categories.food.name_he
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.fifths[5],
"name": year.categories.housing_dwelling_and_household_maintenance.name_he
}, {
"value": year.categories.clothing_and_footwear.fifths[5],
"name": year.categories.clothing_and_footwear.name_he
},{
"value": year.categories.miscellaneous_goods_and_services.fifths[5],
"name": year.categories.miscellaneous_goods_and_services.name_he,
},
{
"value": year.categories.health.fifths[5],
"name": year.categories.health.name_he
}, {
"value": year.categories.transport_and_communication.fifths[5],
"name": year.categories.transport_and_communication.name_he
}];
var innerWidth = window.innerWidth;
var areaChartHeight = 69;
//var filterWidth=0.05171103 * innerWidth;
//var areaChartWidth = innerWidth - filterWidth;
var gap = innerWidth / 9;
var left = -1 * gap;
var year = "2003";
var i = 0;
var lineData = [{
"x": i += gap,
"y": 25055
}, {
"x": i += gap,
"y": 170555
}, {
"x": i += gap,
"y": 140555
}, {
"x": i += gap,
"y": 22066
}, {
"x": i += gap,
"y": 22055
}, {
"x": i += gap,
"y": 19033
}, {
"x": i += gap,
"y": 17044
}, {
"x": i += gap,
"y": 14033
}, {
"x": i += gap,
"y": 20055
}];
var svg = d3.select("body").append("svg")
.attr("width", innerWidth)
.attr("height", areaChartHeight);
var area = d3.svg.area()
.interpolate("monotone")
.x(function(d) {
return x(d.x);
})
.y0(areaChartHeight)
.y1(function(d) {
return y(d.y);
});
var lineFunction = d3.svg.line()
.x(function(d) {
return d.x;
})
.y(function(d) {
return d.y;
});
var x = d3.scale.linear().range([0, innerWidth]);
var y = d3.scale.linear().range([areaChartHeight+40,0]);
x.domain(d3.extent(lineData, function(d) {
return d.x;
}));
y.domain([0, d3.max(lineData, function(d) {
return d.y;
})]);
svg.append("path")
.attr("class", "area")
.attr("d", area(lineData));
var linegraph = svg.append("path")
.attr("d", lineFunction(lineData))
.attr("stroke", "red")
.attr("stroke-width", 0)
.attr("fill", "none");
for (var i = 0; i < 9; ++i) {
$("body").append("<section class='year'>"+(year++)+"</section>");
$(".year").eq(i).css({
"width": gap - 1,
"height": areaChartHeight,
"left": left+=gap
});
}
//$("body").append("<section id='filter'>זה אני</section>");
//$("#filter").css({"width":filterWidth,"height":areaChartHeight,"left":left+=gap});
$(".year").click(function(){
$(".yearSelected").removeClass("yearSelected");
$(this).addClass("yearSelected");
});
});
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
housing = [{
"value": year.categories.housing_dwelling_and_household_maintenance.categories.housing_services_consumption.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.housing_services_consumption.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.housing_services_consumption.name_en,
"color": "#ffccdd",
"pic": "",
"height_": 0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.furniture_and_household_equipment.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.furniture_and_household_equipment.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.furniture_and_household_equipment.name_en,
"color": "#ccfddd",
"pic": "",
"height_": 0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.other_housing_expenditures.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.other_housing_expenditures.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.other_housing_expenditures.name_en,
"color": "#fcd53d",
"pic": "",
"height_": 0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.monthly_rent.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.monthly_rent.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.monthly_rent.name_en,
"color": "#f88d5d",
"pic": "",
"height_": 0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.municipal_property_taxes.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.municipal_property_taxes.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.municipal_property_taxes.name_en,
"color": "#fa5c88",
"pic": "",
"height_":0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.maintenance_and_renovation.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.maintenance_and_renovation.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.maintenance_and_renovation.name_en,
"color": "#f2ab4c",
"pic": "",
"height_": 0,
"ratio": 0
}, {
"value": year.categories.housing_dwelling_and_household_maintenance.categories.water.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.water.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.water.name_en,
"color": "#f8c06d",
"pic": "",
"height_": 0,
"ratio": 0
},{
"value": year.categories.housing_dwelling_and_household_maintenance.categories.government_taxes.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.government_taxes.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.government_taxes.name_en,
"color": "#f2fedd",
"pic": "",
"height_":0,
"ratio":0
},{
"value": year.categories.housing_dwelling_and_household_maintenance.categories.miscellaneous_household_articles.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.miscellaneous_household_articles.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.miscellaneous_household_articles.name_en,
"color": "#fef6dd",
"pic": "",
"height_": 0,
"ratio":0
},{
"value": year.categories.housing_dwelling_and_household_maintenance.categories.domestic_help.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.domestic_help.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.domestic_help.name_en,
"color": "#ff45dc",
"pic": "",
"height_":0 ,
"ratio": 0
},{
"value": year.categories.housing_dwelling_and_household_maintenance.categories.electricity_gas_and_fuel_for_dwelling.fifths[fifths],
"name": year.categories.housing_dwelling_and_household_maintenance.categories.electricity_gas_and_fuel_for_dwelling.name_he,
"nameEn": year.categories.housing_dwelling_and_household_maintenance.categories.electricity_gas_and_fuel_for_dwelling.name_en,
"color": "#ff12dd",
"pic": "",
"height_":0,
"ratio":0
}];
{
"value": year.categories.clothing_and_footwear.categories.cleaning_and_laundry_outside_home.fifths[fifths],
"name": year.categories.clothing_and_footwear.categories.cleaning_and_laundry_outside_home.name_he,
"nameEn": year.categories.clothing_and_footwear.categories.cleaning_and_laundry_outside_home.name_en,
"color": "#f8ba60",
"pic": "images/washer_icon.svg",
"height_": 182,
"ratio": 1.74691358
},
{
"value": year.categories.clothing_and_footwear.categories.sewing_fabrics_and_accessories.fifths[fifths],
"name": year.categories.clothing_and_footwear.categories.sewing_fabrics_and_accessories.name_he,
"nameEn": year.categories.clothing_and_footwear.categories.sewing_fabrics_and_accessories.name_en,
"color": "#f2ab4c",
"pic": "images/sewing_icon.svg",
"height_": 163,
"ratio": 1.90797546
}
</script>
</head>
<body>
</body>
</html>