// First draft goals

This commit is contained in:
Damien Metzger
2013-10-22 19:59:18 +02:00
parent 2c94e6c042
commit a2be0364da
11 changed files with 390 additions and 4 deletions
+38
View File
@@ -0,0 +1,38 @@
function line_chart_goals(widget_name, chart_details)
{
nv.addGraph(function() {
var chart = nv.models.lineChart()
.useInteractiveGuideline(true)
.x(function(d) { return d[0] })
.y(function(d) { return d[1]/100 })
.color(d3.scale.category10().range());
chart.xAxis
.tickFormat(function(d) {
return d3.time.format('%m/%d/%y')(new Date(d))
});
chart.yAxis
.tickFormat(d3.format(',.1%'));
d3.select('#dash_goals_chart1 svg')
.datum(chart_details.data)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
$(document).ready(function() {
$('.dashgoals_config_input').keyup(function() {
$('.dashgoals_sales').each(function() {
var key = $(this).attr('id').substr(16);
var sales = parseFloat($('#dashgoals_traffic_' + key).val()) * parseFloat($('#dashgoals_average_cart_value_' + key).val()) * parseFloat($('#dashgoals_conversion_rate_' + key).val()) / 100;
if (isNaN(sales))
$(this).text('0');
else
$(this).text(parseInt(sales));
});
});
});