ParallelSeries.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 =
  45. /** @class */
  46. function (_super) {
  47. __extends(ParallelSeriesModel, _super);
  48. function ParallelSeriesModel() {
  49. var _this = _super !== null && _super.apply(this, arguments) || this;
  50. _this.type = ParallelSeriesModel.type;
  51. _this.visualStyleAccessPath = 'lineStyle';
  52. _this.visualDrawType = 'stroke';
  53. return _this;
  54. }
  55. ParallelSeriesModel.prototype.getInitialData = function (option, ecModel) {
  56. return createSeriesData(null, this, {
  57. useEncodeDefaulter: bind(makeDefaultEncode, null, this)
  58. });
  59. };
  60. /**
  61. * User can get data raw indices on 'axisAreaSelected' event received.
  62. *
  63. * @return Raw indices
  64. */
  65. ParallelSeriesModel.prototype.getRawIndicesByActiveState = function (activeState) {
  66. var coordSys = this.coordinateSystem;
  67. var data = this.getData();
  68. var indices = [];
  69. coordSys.eachActiveState(data, function (theActiveState, dataIndex) {
  70. if (activeState === theActiveState) {
  71. indices.push(data.getRawIndex(dataIndex));
  72. }
  73. });
  74. return indices;
  75. };
  76. ParallelSeriesModel.type = 'series.parallel';
  77. ParallelSeriesModel.dependencies = ['parallel'];
  78. ParallelSeriesModel.defaultOption = {
  79. // zlevel: 0,
  80. z: 2,
  81. coordinateSystem: 'parallel',
  82. parallelIndex: 0,
  83. label: {
  84. show: false
  85. },
  86. inactiveOpacity: 0.05,
  87. activeOpacity: 1,
  88. lineStyle: {
  89. width: 1,
  90. opacity: 0.45,
  91. type: 'solid'
  92. },
  93. emphasis: {
  94. label: {
  95. show: false
  96. }
  97. },
  98. progressive: 500,
  99. smooth: false,
  100. animationEasing: 'linear'
  101. };
  102. return ParallelSeriesModel;
  103. }(SeriesModel);
  104. function makeDefaultEncode(seriesModel) {
  105. // The mapping of parallelAxis dimension to data dimension can
  106. // be specified in parallelAxis.option.dim. For example, if
  107. // parallelAxis.option.dim is 'dim3', it mapping to the third
  108. // dimension of data. But `data.encode` has higher priority.
  109. // Moreover, parallelModel.dimension should not be regarded as data
  110. // dimensions. Consider dimensions = ['dim4', 'dim2', 'dim6'];
  111. var parallelModel = seriesModel.ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));
  112. if (!parallelModel) {
  113. return;
  114. }
  115. var encodeDefine = {};
  116. each(parallelModel.dimensions, function (axisDim) {
  117. var dataDimIndex = convertDimNameToNumber(axisDim);
  118. encodeDefine[axisDim] = dataDimIndex;
  119. });
  120. return encodeDefine;
  121. }
  122. function convertDimNameToNumber(dimName) {
  123. return +dimName.replace('dim', '');
  124. }
  125. export default ParallelSeriesModel;