ParallelSeries.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /**
  20. * AUTO-GENERATED FILE. DO NOT MODIFY.
  21. */
  22. /*
  23. * Licensed to the Apache Software Foundation (ASF) under one
  24. * or more contributor license agreements. See the NOTICE file
  25. * distributed with this work for additional information
  26. * regarding copyright ownership. The ASF licenses this file
  27. * to you under the Apache License, Version 2.0 (the
  28. * "License"); you may not use this file except in compliance
  29. * with the License. You may obtain a copy of the License at
  30. *
  31. * http://www.apache.org/licenses/LICENSE-2.0
  32. *
  33. * Unless required by applicable law or agreed to in writing,
  34. * software distributed under the License is distributed on an
  35. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  36. * KIND, either express or implied. See the License for the
  37. * specific language governing permissions and limitations
  38. * under the License.
  39. */
  40. import { __extends } from "tslib";
  41. import { each, bind } from 'zrender/lib/core/util.js';
  42. import SeriesModel from '../../model/Series.js';
  43. import createSeriesData from '../helper/createSeriesData.js';
  44. var ParallelSeriesModel = /** @class */function (_super) {
  45. __extends(ParallelSeriesModel, _super);
  46. function ParallelSeriesModel() {
  47. var _this = _super !== null && _super.apply(this, arguments) || this;
  48. _this.type = ParallelSeriesModel.type;
  49. _this.visualStyleAccessPath = 'lineStyle';
  50. _this.visualDrawType = 'stroke';
  51. return _this;
  52. }
  53. ParallelSeriesModel.prototype.getInitialData = function (option, ecModel) {
  54. return createSeriesData(null, this, {
  55. useEncodeDefaulter: bind(makeDefaultEncode, null, this)
  56. });
  57. };
  58. /**
  59. * User can get data raw indices on 'axisAreaSelected' event received.
  60. *
  61. * @return Raw indices
  62. */
  63. ParallelSeriesModel.prototype.getRawIndicesByActiveState = function (activeState) {
  64. var coordSys = this.coordinateSystem;
  65. var data = this.getData();
  66. var indices = [];
  67. coordSys.eachActiveState(data, function (theActiveState, dataIndex) {
  68. if (activeState === theActiveState) {
  69. indices.push(data.getRawIndex(dataIndex));
  70. }
  71. });
  72. return indices;
  73. };
  74. ParallelSeriesModel.type = 'series.parallel';
  75. ParallelSeriesModel.dependencies = ['parallel'];
  76. ParallelSeriesModel.defaultOption = {
  77. // zlevel: 0,
  78. z: 2,
  79. coordinateSystem: 'parallel',
  80. parallelIndex: 0,
  81. label: {
  82. show: false
  83. },
  84. inactiveOpacity: 0.05,
  85. activeOpacity: 1,
  86. lineStyle: {
  87. width: 1,
  88. opacity: 0.45,
  89. type: 'solid'
  90. },
  91. emphasis: {
  92. label: {
  93. show: false
  94. }
  95. },
  96. progressive: 500,
  97. smooth: false,
  98. animationEasing: 'linear'
  99. };
  100. return ParallelSeriesModel;
  101. }(SeriesModel);
  102. function makeDefaultEncode(seriesModel) {
  103. // The mapping of parallelAxis dimension to data dimension can
  104. // be specified in parallelAxis.option.dim. For example, if
  105. // parallelAxis.option.dim is 'dim3', it mapping to the third
  106. // dimension of data. But `data.encode` has higher priority.
  107. // Moreover, parallelModel.dimension should not be regarded as data
  108. // dimensions. Consider dimensions = ['dim4', 'dim2', 'dim6'];
  109. var parallelModel = seriesModel.ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));
  110. if (!parallelModel) {
  111. return;
  112. }
  113. var encodeDefine = {};
  114. each(parallelModel.dimensions, function (axisDim) {
  115. var dataDimIndex = convertDimNameToNumber(axisDim);
  116. encodeDefine[axisDim] = dataDimIndex;
  117. });
  118. return encodeDefine;
  119. }
  120. function convertDimNameToNumber(dimName) {
  121. return +dimName.replace('dim', '');
  122. }
  123. export default ParallelSeriesModel;