d3.json('data/fake_users3.json', function(data) {
for(var i = 0; i < data.length; i++) {
data[i] = MG.convert.date(data[i], 'date');
}
MG.data_graphic({
title: "Preserving the aspect ratio",
description: "You can automatically set the width or height of a data graphic to fit its parent element. When done the graphic will rescale to fit the size of the parent element while preserving its aspect ratio.",
data: data,
full_width: true,
height: 300,
right: 40,
x_extended_ticks: true,
target: '#aspect1',
x_accessor: 'date',
y_accessor: 'value'
});
});
d3.json('data/brief-1.json', function(data) {
data = MG.convert.date(data, 'date');
MG.data_graphic({
title: "Small Text Inferred By Size",
description: "If args.width - args.left - args.right is smaller than args.small_width_threshold, and the similarly for the height, the text size automatically scales so that it is slightly smaller.",
data: data,
width: 240,
height: 140,
right: 20,
top: 20,
xax_count: 4,
target: '#small1'
});
});
d3.json('data/brief-2.json', function(data) {
data = MG.convert.date(data, 'date');
MG.data_graphic({
title: "Small Text",
description: "By adding small_text to true, we can force the use of smaller axis text regardless of the width or height.",
data: data,
width: 295,
height: 150,
right: 10,
small_text: true,
xax_count: 4,
target: '#small2'
});
});