EffectScatterView.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. var echarts = require("../../echarts");
  20. var SymbolDraw = require("../helper/SymbolDraw");
  21. var EffectSymbol = require("../helper/EffectSymbol");
  22. var matrix = require("zrender/lib/core/matrix");
  23. var pointsLayout = require("../../layout/points");
  24. /*
  25. * Licensed to the Apache Software Foundation (ASF) under one
  26. * or more contributor license agreements. See the NOTICE file
  27. * distributed with this work for additional information
  28. * regarding copyright ownership. The ASF licenses this file
  29. * to you under the Apache License, Version 2.0 (the
  30. * "License"); you may not use this file except in compliance
  31. * with the License. You may obtain a copy of the License at
  32. *
  33. * http://www.apache.org/licenses/LICENSE-2.0
  34. *
  35. * Unless required by applicable law or agreed to in writing,
  36. * software distributed under the License is distributed on an
  37. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  38. * KIND, either express or implied. See the License for the
  39. * specific language governing permissions and limitations
  40. * under the License.
  41. */
  42. var _default = echarts.extendChartView({
  43. type: 'effectScatter',
  44. init: function () {
  45. this._symbolDraw = new SymbolDraw(EffectSymbol);
  46. },
  47. render: function (seriesModel, ecModel, api) {
  48. var data = seriesModel.getData();
  49. var effectSymbolDraw = this._symbolDraw;
  50. effectSymbolDraw.updateData(data);
  51. this.group.add(effectSymbolDraw.group);
  52. },
  53. updateTransform: function (seriesModel, ecModel, api) {
  54. var data = seriesModel.getData();
  55. this.group.dirty();
  56. var res = pointsLayout().reset(seriesModel);
  57. if (res.progress) {
  58. res.progress({
  59. start: 0,
  60. end: data.count()
  61. }, data);
  62. }
  63. this._symbolDraw.updateLayout(data);
  64. },
  65. _updateGroupTransform: function (seriesModel) {
  66. var coordSys = seriesModel.coordinateSystem;
  67. if (coordSys && coordSys.getRoamTransform) {
  68. this.group.transform = matrix.clone(coordSys.getRoamTransform());
  69. this.group.decomposeTransform();
  70. }
  71. },
  72. remove: function (ecModel, api) {
  73. this._symbolDraw && this._symbolDraw.remove(api);
  74. },
  75. dispose: function () {}
  76. });
  77. module.exports = _default;