diff --git a/micropolar.js b/micropolar.js index 587cc56..4df04cd 100644 --- a/micropolar.js +++ b/micropolar.js @@ -1,4 +1,4 @@ -micropolar = {version: '0.1.0'}; +micropolar = {version: '0.1.0'}; micropolar.chart = {}; micropolar.chart.RadialAxis = function module() { @@ -325,7 +325,7 @@ micropolar.chart.PolarAreaChart = function module() { var h = radialScale(d[1]); var baseW = Math.tan(triangleAngle) * h; return 'M'+[[0, 0], [h, baseW], [h, -baseW]].join('L')+'Z' }, - transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta - 90 + (angularScale(i))) +')'} + transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta + (angularScale(i))) +')'} // transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta - 90 + (angularScale(d[0]))) +')'} }) diff --git a/src/area_chart.js b/src/area_chart.js old mode 100755 new mode 100644 index a67af38..56222e7 --- a/src/area_chart.js +++ b/src/area_chart.js @@ -26,7 +26,11 @@ micropolar.AreaChart = function module() { var h = config.radialScale(d[1]); var baseW = Math.tan(triangleAngle) * h; return 'M'+[[0, 0], [h, baseW], [h, -baseW]].join('L')+'Z' }, +<<<<<<< HEAD:src/polar_area_chart.js + transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta + (angularScale(i))) +')'} +======= transform: function(d, i){ return 'rotate('+ (config.axisConfig.originTheta - 90 + (config.angularScale(i))) +')'} +>>>>>>> upstream/master:src/area_chart.js // transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta - 90 + (angularScale(d[0]))) +')'} }) .style(markStyle); diff --git a/src/polar_area_stacked_chart.js b/src/polar_area_stacked_chart.js new file mode 100644 index 0000000..249b521 --- /dev/null +++ b/src/polar_area_stacked_chart.js @@ -0,0 +1,60 @@ +micropolar.chart.PolarAreaStackedChart = function module() { + var config = { + dotRadius: 5, + axis: null, + containerSelector: 'body' + }; + var dispatch = d3.dispatch('hover'); + + function exports(_datum) { + var _datumStacked = d3.nest().key(function (d) { return d[3] }).entries(_datum); + _datumStacked.forEach(function (d) { + d.values.map(function (val) { + val.x = val[0]; + val.y = +val[1]; + return val; + }) + }); + + var stacked = d3.layout.stack(); + + stacked(_datumStacked); + + d3.select(config.containerSelector) + .datum(_datumStacked) + .each(function (_data, _index) { + + config.axis.config({ containerSelector: this }) + config.axis(_datum); + + radialScale = config.axis.radialScale(); + angularScale = config.axis.angularScale(); + axisConfig = config.axis.config(); + + var triangleAngle = (360 / data.length) * Math.PI / 180 / 2; + + var geometryGroup = d3.select(this).select('svg g.geometry'); + + var geometry = geometryGroup.selectAll('path.mark') + .data(_data); + geometry.enter().append('path').attr({ 'class': 'mark' }); + geometry.attr({ + d: function (d, i) { + var h = radialScale(d[1]); + var baseW = Math.tan(triangleAngle) * h; + return 'M' + [[0, 0], [h, baseW], [h, -baseW]].join('L') + 'Z' + }, + transform: function (d, i) { return 'rotate(' + (axisConfig.originTheta + (angularScale(i))) + ')' } + // transform: function(d, i){ return 'rotate('+ (axisConfig.originTheta - 90 + (angularScale(d[0]))) +')'} + }) + + }); + } + exports.config = function (_x) { + if (!arguments.length) return config; + micropolar._override(_x, config); + return this; + }; + d3.rebind(exports, dispatch, 'on'); + return exports; +} \ No newline at end of file diff --git a/web.config b/web.config new file mode 100644 index 0000000..0b4280c --- /dev/null +++ b/web.config @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +