Commit 5affb553 authored by Evgeny's avatar Evgeny

Extend marker functionality. Remove unused method

parent f3873bbc
...@@ -3410,9 +3410,14 @@ ...@@ -3410,9 +3410,14 @@
if($$.currentMarkerTypeId === undefined){ if($$.currentMarkerTypeId === undefined){
var length = 0; var length = 0;
for(var _ in $$.config.marker_types){ // TODO better counting
// If some markers are set manually, this will not produce
// best auto markers
for(var _type in $$.config.marker_types){
if($$.config.marker_types[_type] !== null){
length++; length++;
} }
}
$$.currentMarkerTypeId = length % $$.config.allMarkersTypes.length; $$.currentMarkerTypeId = length % $$.config.allMarkersTypes.length;
} }
...@@ -3441,7 +3446,15 @@ ...@@ -3441,7 +3446,15 @@
c3_chart_internal_fn.getMarker = function(d, i){ c3_chart_internal_fn.getMarker = function(d, i){
var $$ = this; var $$ = this;
if(!$$.config.marker_types || !$$.config.marker_types[d.id]){ // Null is special case when user wants to set marker
// but doesn't care which one. Then marker will be set automaticly, trying to choose the best one
// for each id
if($$.config.point_show[d.id] && $$.config.marker_types[d.id] === null){
$$.setMarker(d.id);
}
// If marker type isn't set at all, draw circle
if($$.config.marker_types[d.id] === undefined){
return marker_fn.circle($$.pointR(d, i)).node(); return marker_fn.circle($$.pointR(d, i)).node();
} }
...@@ -3450,19 +3463,6 @@ ...@@ -3450,19 +3463,6 @@
return func($$.pointR(d, i), $$.color(d, i)).node(); return func($$.pointR(d, i), $$.color(d, i)).node();
}; };
// c3_chart_internal.setMarker is probably extended version of this
// If so, this need to be deleted and all tests for it rewriten using setMarker
c3_chart_fn.dataMarker = function(id, value){
var $$ = this.internal;
if(typeof value !== 'string') {
return $$.config.marker_types[id];
}
if($$.config.marker_types[id] !== value){
$$.config.marker_types[id] = value;
}
};
c3_chart_internal_fn.initBar = function () { c3_chart_internal_fn.initBar = function () {
var $$ = this; var $$ = this;
$$.main.select('.' + CLASS.chart).append("g") $$.main.select('.' + CLASS.chart).append("g")
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -117,9 +117,14 @@ c3_chart_internal_fn.setMarker = function(id, type){ ...@@ -117,9 +117,14 @@ c3_chart_internal_fn.setMarker = function(id, type){
if($$.currentMarkerTypeId === undefined){ if($$.currentMarkerTypeId === undefined){
var length = 0; var length = 0;
for(var _ in $$.config.marker_types){ // TODO better counting
// If some markers are set manually, this will not produce
// best auto markers
for(var _type in $$.config.marker_types){
if($$.config.marker_types[_type] !== null){
length++; length++;
} }
}
$$.currentMarkerTypeId = length % $$.config.allMarkersTypes.length; $$.currentMarkerTypeId = length % $$.config.allMarkersTypes.length;
} }
...@@ -148,7 +153,15 @@ c3_chart_fn.getMarkerType = function(id){ ...@@ -148,7 +153,15 @@ c3_chart_fn.getMarkerType = function(id){
c3_chart_internal_fn.getMarker = function(d, i){ c3_chart_internal_fn.getMarker = function(d, i){
var $$ = this; var $$ = this;
if(!$$.config.marker_types || !$$.config.marker_types[d.id]){ // Null is special case when user wants to set marker
// but doesn't care which one. Then marker will be set automaticly, trying to choose the best one
// for each id
if($$.config.point_show[d.id] && $$.config.marker_types[d.id] === null){
$$.setMarker(d.id);
}
// If marker type isn't set at all, draw circle
if($$.config.marker_types[d.id] === undefined){
return marker_fn.circle($$.pointR(d, i)).node(); return marker_fn.circle($$.pointR(d, i)).node();
} }
...@@ -156,16 +169,3 @@ c3_chart_internal_fn.getMarker = function(d, i){ ...@@ -156,16 +169,3 @@ c3_chart_internal_fn.getMarker = function(d, i){
return func($$.pointR(d, i), $$.color(d, i)).node(); return func($$.pointR(d, i), $$.color(d, i)).node();
}; };
// c3_chart_internal.setMarker is probably extended version of this
// If so, this need to be deleted and all tests for it rewriten using setMarker
c3_chart_fn.dataMarker = function(id, value){
var $$ = this.internal;
if(typeof value !== 'string') {
return $$.config.marker_types[id];
}
if($$.config.marker_types[id] !== value){
$$.config.marker_types[id] = value;
}
};
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