Commit 342feb4c authored by Evgeny's avatar Evgeny

Add all marker types to config by default

parent 01626ef5
......@@ -1256,8 +1256,18 @@
// line
line_connectNull: false,
line_step_type: 'step',
marker_types: undefined,
allMarkersTypes: [],
marker_types: {},
allMarkersTypes: [
'rhombus',
'square',
'triangle',
'cross',
'asterisk',
'circle',
'plus',
'serif',
'serifRight'
],
// bar
bar_width: undefined,
bar_width_ratio: 0.6,
......@@ -3417,6 +3427,9 @@
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') {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
describe('c3 markers', function () {
'use strict';
var chart, d3;
var args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25],
['data3', 150, 120, 110, 140, 115, 125]
]
},
type: 'line'
};
beforeEach(function (done) {
chart = window.initChart(chart, args, done);
d3 = chart.internal.d3;
});
describe('#setMarkers', function(){
it('should set marker visible', function(){
chart.internal.setMarker('data1');
expect(chart.internal.config.point_show['data1']).toBe(true);
});
it('should set different types of markers', function(){
var allMarkers = chart.internal.config.allMarkersTypes;
for(var i = 0; i < allMarkers.length; i++){
chart.internal.setMarker('data' + i);
expect(chart.internal.config.point_show['data'+i]).toBe(true);
expect(chart.internal.config.marker_types['data'+i]).toBe(allMarkers[i]);
}
chart.internal.setMarker('data' + allMarkers.length);
expect(chart.internal.config.point_show['data'+ allMarkers.length]).toBe(true);
expect(chart.internal.config.marker_types['data' + allMarkers.length]).toBe(allMarkers[0]);
});
});
});
......@@ -151,8 +151,18 @@ c3_chart_internal_fn.getDefaultConfig = function () {
// line
line_connectNull: false,
line_step_type: 'step',
marker_types: undefined,
allMarkersTypes: [],
marker_types: {},
allMarkersTypes: [
'rhombus',
'square',
'triangle',
'cross',
'asterisk',
'circle',
'plus',
'serif',
'serifRight'
],
// bar
bar_width: undefined,
bar_width_ratio: 0.6,
......
......@@ -148,6 +148,9 @@ c3_chart_internal_fn.getMarker = function(d, i){
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') {
......
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