diff --git a/src/data/helper/sourceHelper.js b/src/data/helper/sourceHelper.js index a988f2e18967afdd09186e320948c4909f9a8c6d..58c7d6705fd4fa0ece32efcb7616dc74ab67583b 100644 --- a/src/data/helper/sourceHelper.js +++ b/src/data/helper/sourceHelper.js @@ -374,6 +374,15 @@ function makeDefaultEncode( if (coordSysDefine.firstCategoryDimIndex == null) { var dataDim = datasetRecord.valueWayDim++; encode[coordDim] = dataDim; + + // ??? TODO give a better default series name rule? + // especially when encode x y specified. + // consider: when mutiple series share one dimension + // category axis, series name should better use + // the other dimsion name. On the other hand, use + // both dimensions name. + + encodeSeriesName.push(dataDim); // encodeTooltip.push(dataDim); // encodeLabel.push(dataDim); } diff --git a/test/dataset-category.html b/test/dataset-category.html index 5a8013f1ec61292361011081ba5403c7773eb087..34f0e4f991d9d847c39df75992d921d3b7de35b4 100644 --- a/test/dataset-category.html +++ b/test/dataset-category.html @@ -19,13 +19,8 @@ - -
- + @@ -60,12 +55,12 @@ ], function (echarts) { var source = [ [21, 120, 220, 150, 320, 820], - [21, 132, 182, 232, 332, 932], - [21, 101, 191, 201, 301, 901], - [21, 134, 234, 154, 334, 934], - [21, 90, 290, 190, 309, 1290], - [21, 230, 330, 330, 330, 1330], - [21, 210, 310, 410, 320, 1320] + [31, 132, 182, 232, 332, 932], + [41, 101, 191, 201, 301, 901], + [51, 134, 234, 154, 334, 934], + [61, 90, 290, 190, 309, 1290], + [71, 230, 330, 330, 330, 1330], + [81, 210, 310, 410, 320, 1320] ]; var option = { @@ -74,16 +69,16 @@ grid: {}, xAxis: {}, yAxis: {}, + dataZoom: [{}, {type: 'inside'}], dataset: [{ dimensions: ['G', 'H', 'I', 'Q', 'R'], + // sourceHeader: true, source: source }], series: [ - {type:'scatter'}, - {type:'scatter'}, - {type:'scatter'}, - {type:'scatter'}, - {type:'scatter'} + {type:'scatter', label: {show: true, position: 'top', textBorderWidth: 2, textBorderColor: '#fff'}, dimensions: ['cccccccccc', 'ddddddddddd']}, + {type:'scatter', label: {show: true, position: 'top', textBorderWidth: 2, textBorderColor: '#fff'}}, + {type:'scatter', label: {show: true, position: 'top', textBorderWidth: 2, textBorderColor: '#fff'}, sourceHeader: true} ] }; testHelper.create(echarts, 'specify-dimensions', { @@ -91,7 +86,8 @@ dataTable: source, option: option, info: { - dimensions: option.dataset[0].dimensions + dimensions: option.dataset[0].dimensions, + serise: option.series } }); }); diff --git a/test/lib/testHelper.js b/test/lib/testHelper.js index 2c8528c0f5dd8a0e1f6a7e63d193c335f0a38765..8da76a2a352e2422be42348d126f9457f9ccc38a 100644 --- a/test/lib/testHelper.js +++ b/test/lib/testHelper.js @@ -323,7 +323,7 @@ str = preStr + quotationMark + obj + quotationMark; break; default: - throw new Error('Illegal type "' + objType + '" at "' + obj + quotationMark); + str = preStr + obj + ''; } return {