Skip to content

Commit

Permalink
Fix issue w3c#99
Browse files Browse the repository at this point in the history
  • Loading branch information
almossawi committed Jul 26, 2014
1 parent 8c52562 commit 33b670f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions js/main.js
Expand Up @@ -69,7 +69,7 @@ $(document).ready(function() {

d3.json('data/fake_users2.json', function(data) {
for(var i=0;i<data.length;i++) {
data[i] = convert_dates(data[i]);
data[i] = convert_dates(data[i], 'date');
}

moz_chart({
Expand Down Expand Up @@ -118,7 +118,7 @@ $(document).ready(function() {

d3.json('data/fake_users3.json', function(data) {
for(var i=0;i<data.length;i++) {
data[i] = convert_dates(data[i]);
data[i] = convert_dates(data[i], 'date');
}

//linked multi-line charts
Expand All @@ -137,7 +137,7 @@ $(document).ready(function() {
})

d3.json('data/confidence_band.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');
moz_chart({
title: "Confidence Band",
description: "This is an example of a chart with a confidence band and extended x-axis ticks enabled.",
Expand All @@ -160,7 +160,7 @@ $(document).ready(function() {
d3.json('data/log.json', function(data){
data = [data];
for(var i=0;i<data.length;i++) {
data[i] = convert_dates(data[i]);
data[i] = convert_dates(data[i], 'date');
};
moz_chart({
title: "Log Scale",
Expand All @@ -178,7 +178,7 @@ $(document).ready(function() {

d3.json('data/some_percentage.json', function(data) {
for(var i=0;i<data.length;i++) {
data[i] = convert_dates(data[i]);
data[i] = convert_dates(data[i], 'date');
};

var markers = [{
Expand Down Expand Up @@ -236,7 +236,7 @@ $(document).ready(function() {
})

d3.json('data/some_currency.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');
moz_chart({
title: "Some Currency",
description: "Here is an example that uses custom units for currency.",
Expand Down Expand Up @@ -287,7 +287,7 @@ $(document).ready(function() {

// lower section
d3.json('data/brief-1.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');

moz_chart({
title: "Linked Charts",
Expand Down Expand Up @@ -319,7 +319,7 @@ $(document).ready(function() {
})

d3.json('data/split_by.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');

split_by_data = moz_chart({
title: "Downloads by Channel",
Expand Down Expand Up @@ -350,7 +350,7 @@ $(document).ready(function() {
})

d3.json('data/brief-2.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');

moz_chart({
title: "Other Linked Chart",
Expand Down Expand Up @@ -383,7 +383,7 @@ $(document).ready(function() {
})

d3.json('data/float.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');

moz_chart({
title: "Changing Precision 1",
Expand Down Expand Up @@ -421,7 +421,7 @@ $(document).ready(function() {
})

d3.json('data/neg1.json', function(data) {
data = convert_dates(data);
data = convert_dates(data, 'date');

moz_chart({
title: "Negative Values 1",
Expand Down
6 changes: 3 additions & 3 deletions js/metrics-graphics.js
Expand Up @@ -1126,10 +1126,10 @@ function modify_time_period(data, past_n_days) {
}


function convert_dates(data){
data = data.map(function(d){
function convert_dates(data, x_accessor) {
data = data.map(function(d) {
var fff = d3.time.format('%Y-%m-%d');
d['date'] = fff.parse(d['date']);
d[x_accessor] = fff.parse(d[x_accessor]);
return d;
});

Expand Down

0 comments on commit 33b670f

Please sign in to comment.