Commit 22e03ae3 authored by Evgeny's avatar Evgeny

Half-fix categories for xy

parent 8af0b900
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner</title>
<link rel="shortcut icon" type="image/png" href=".grunt/grunt-contrib-jasmine/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href=".grunt/grunt-contrib-jasmine/jasmine.css">
<link rel="stylesheet" type="text/css" href="c3.css">
</head>
<body>
<script src=".grunt/grunt-contrib-jasmine/es5-shim.js"></script>
<script src=".grunt/grunt-contrib-jasmine/jasmine.js"></script>
<script src=".grunt/grunt-contrib-jasmine/jasmine-html.js"></script>
<script src=".grunt/grunt-contrib-jasmine/json2.js"></script>
<script src=".grunt/grunt-contrib-jasmine/boot.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/async-buffer/index.js"></script>
<script src="spec/c3-helper.js"></script>
<script src="c3.js"></script>
<script src="spec/api.chart-spec.js"></script>
<script src="spec/api.color-spec.js"></script>
<script src="spec/api.data-spec.js"></script>
<script src="spec/api.grid-spec.js"></script>
<script src="spec/api.load-spec.js"></script>
<script src="spec/api.zoom-spec.js"></script>
<script src="spec/arc-spec.js"></script>
<script src="spec/axis-spec.js"></script>
<script src="spec/c3-spec.js"></script>
<script src="spec/class-spec.js"></script>
<script src="spec/core-spec.js"></script>
<script src="spec/data-spec.js"></script>
<script src="spec/domain-spec.js"></script>
<script src="spec/grid-spec.js"></script>
<script src="spec/interaction-spec.js"></script>
<script src="spec/legend-spec.js"></script>
<script src="spec/markers-spec.js"></script>
<script src="spec/shape.bar-spec.js"></script>
<script src="spec/shape.line-spec.js"></script>
<script src="spec/stacked-spec.js"></script>
<script src="spec/tooltip-spec.js"></script>
<script src="spec/type-spec.js"></script>
<script src="spec/zoom-spec.js"></script>
<script src=".grunt/grunt-contrib-jasmine/reporter.js"></script>
</body>
</html>
...@@ -891,7 +891,7 @@ ...@@ -891,7 +891,7 @@
if ($$.isTimeSeries()) { if ($$.isTimeSeries()) {
value = $$.parseDate(d.value); value = $$.parseDate(d.value);
} }
else if ($$.isCategorized() && typeof d.value === 'string') { else if ($$.isCategorized() && typeof d.value === 'string' && !$$.config.is_xy) {
value = $$.config.axis_x_categories.indexOf(d.value); value = $$.config.axis_x_categories.indexOf(d.value);
} }
return Math.ceil($$.x(value)); return Math.ceil($$.x(value));
...@@ -1799,7 +1799,7 @@ ...@@ -1799,7 +1799,7 @@
if ($$.isTimeSeries()) { if ($$.isTimeSeries()) {
x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)); x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index));
} }
else if ($$.isCustomX() && !$$.isCategorized()) { else if ($$.isCustomX()) {
x = isValue(rawX) ? +rawX : $$.getXValue(id, index); x = isValue(rawX) ? +rawX : $$.getXValue(id, index);
} }
else { else {
...@@ -2249,7 +2249,7 @@ ...@@ -2249,7 +2249,7 @@
targets.forEach(function (t) { targets.forEach(function (t) {
var i; var i;
// sort values by its x // sort values by its x
if (config.data_xSort) { if (false) {
t.values = t.values.sort(function (v1, v2) { t.values = t.values.sort(function (v1, v2) {
var x1 = v1.x || v1.x === 0 ? v1.x : Infinity, var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
x2 = v2.x || v2.x === 0 ? v2.x : Infinity; x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
...@@ -5148,15 +5148,15 @@ ...@@ -5148,15 +5148,15 @@
}; };
c3_chart_internal_fn.getSizeCoef = function(){ c3_chart_internal_fn.getSizeCoef = function(){
var $$ = this; var $$ = this, margin=$$.margin;
// Excel shortens ticks the way so they don't take more than half of all chart // Excel shortens ticks the way so they don't take more than half of all chart
if($$.config.axis_rotated){ if($$.config.axis_rotated){
var widthPadding = -30; var widthPadding = margin.left + margin.right;
return $$.getCurrentWidth()/2 + widthPadding; return ($$.getCurrentWidth() - widthPadding) / 2;
} else { } else {
var heightPadding = -30; var heightPadding = margin.top + margin.bottom;
return $$.getCurrentHeight()/2 + heightPadding; return ($$.getCurrentHeight() - heightPadding) / 2;
} }
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -513,15 +513,15 @@ c3_chart_internal_fn.getTicksCoef = function(){ ...@@ -513,15 +513,15 @@ c3_chart_internal_fn.getTicksCoef = function(){
}; };
c3_chart_internal_fn.getSizeCoef = function(){ c3_chart_internal_fn.getSizeCoef = function(){
var $$ = this; var $$ = this, margin=$$.margin;
// Excel shortens ticks the way so they don't take more than half of all chart // Excel shortens ticks the way so they don't take more than half of all chart
if($$.config.axis_rotated){ if($$.config.axis_rotated){
var widthPadding = -30; var widthPadding = margin.left + margin.right;
return $$.getCurrentWidth()/2 + widthPadding; return ($$.getCurrentWidth() - widthPadding) / 2;
} else { } else {
var heightPadding = -30; var heightPadding = margin.top + margin.bottom;
return $$.getCurrentHeight()/2 + heightPadding; return ($$.getCurrentHeight() - heightPadding) / 2;
} }
}; };
......
...@@ -886,7 +886,7 @@ c3_chart_internal_fn.xv = function (d) { ...@@ -886,7 +886,7 @@ c3_chart_internal_fn.xv = function (d) {
if ($$.isTimeSeries()) { if ($$.isTimeSeries()) {
value = $$.parseDate(d.value); value = $$.parseDate(d.value);
} }
else if ($$.isCategorized() && typeof d.value === 'string') { else if ($$.isCategorized() && typeof d.value === 'string' && !$$.config.is_xy) {
value = $$.config.axis_x_categories.indexOf(d.value); value = $$.config.axis_x_categories.indexOf(d.value);
} }
return Math.ceil($$.x(value)); return Math.ceil($$.x(value));
......
...@@ -162,7 +162,7 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) { ...@@ -162,7 +162,7 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
targets.forEach(function (t) { targets.forEach(function (t) {
var i; var i;
// sort values by its x // sort values by its x
if (config.data_xSort) { if (false) {
t.values = t.values.sort(function (v1, v2) { t.values = t.values.sort(function (v1, v2) {
var x1 = v1.x || v1.x === 0 ? v1.x : Infinity, var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
x2 = v2.x || v2.x === 0 ? v2.x : Infinity; x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
......
...@@ -83,7 +83,7 @@ c3_chart_internal_fn.generateTargetX = function (rawX, id, index) { ...@@ -83,7 +83,7 @@ c3_chart_internal_fn.generateTargetX = function (rawX, id, index) {
if ($$.isTimeSeries()) { if ($$.isTimeSeries()) {
x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)); x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index));
} }
else if ($$.isCustomX() && !$$.isCategorized()) { else if ($$.isCustomX()) {
x = isValue(rawX) ? +rawX : $$.getXValue(id, index); x = isValue(rawX) ? +rawX : $$.getXValue(id, index);
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment