| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /**
- * DevExtreme (viz/polar_chart.js)
- * Version: 19.1.16
- * Build date: Tue Oct 18 2022
- *
- * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
- * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
- */
- "use strict";
- var _noop = require("../core/utils/common").noop;
- var registerComponent = require("../core/component_registrator");
- var extend = require("../core/utils/extend").extend;
- var vizUtils = require("./core/utils");
- var AdvancedChart = require("./chart_components/advanced_chart").AdvancedChart;
- var DEFAULT_PANE_NAME = "default";
- var dxPolarChart = AdvancedChart.inherit({
- _themeSection: "polar",
- _createPanes: function() {
- return [{
- name: DEFAULT_PANE_NAME
- }]
- },
- _checkPaneName: function() {
- return true
- },
- _getAxisRenderingOptions: function(typeSelector) {
- var isArgumentAxis = "argumentAxis" === typeSelector;
- var type = isArgumentAxis ? "circular" : "linear";
- var useSpiderWeb = this.option("useSpiderWeb");
- if (useSpiderWeb) {
- type += "Spider"
- }
- return {
- axisType: "polarAxes",
- drawingType: type
- }
- },
- _prepareAxisOptions: function(typeSelector, axisOptions) {
- var isArgumentAxis = "argumentAxis" === typeSelector;
- var themeManager = this._themeManager;
- var axisUserOptions = this.option("argumentAxis");
- var argumentAxisOptions = themeManager.getOptions("argumentAxis", axisUserOptions) || {};
- var startAngle = isFinite(argumentAxisOptions.startAngle) ? vizUtils.normalizeAngle(argumentAxisOptions.startAngle) : 0;
- return {
- type: this.option("useSpiderWeb") && isArgumentAxis ? "discrete" : axisOptions.type,
- isHorizontal: true,
- showCustomBoundaryTicks: isArgumentAxis,
- startAngle: startAngle,
- endAngle: startAngle + 360
- }
- },
- _optionChangesMap: {
- useSpiderWeb: "AXES_AND_PANES"
- },
- _getExtraOptions: function() {
- return {
- spiderWidget: this.option("useSpiderWeb")
- }
- },
- _prepareToRender: function() {
- this._appendAxesGroups();
- return {}
- },
- _calcCanvas: function() {
- var canvas = extend({}, this._canvas);
- var argumentAxis = this.getArgumentAxis();
- var margins = argumentAxis.getMargins();
- Object.keys(margins).forEach(function(margin) {
- return canvas[margin] = canvas["original".concat(margin[0].toUpperCase()).concat(margin.slice(1))] + margins[margin]
- });
- return canvas
- },
- _renderAxes: function(drawOptions) {
- var that = this;
- var valueAxis = that._getValueAxis();
- var argumentAxis = that.getArgumentAxis();
- argumentAxis.draw(that._canvas);
- valueAxis.setSpiderTicks(argumentAxis.getSpiderTicks());
- var canvas = that._calcCanvas();
- argumentAxis.updateSize(canvas);
- valueAxis.draw(canvas);
- return canvas
- },
- _getValueAxis: function() {
- return this._valueAxes[0]
- },
- _shrinkAxes: function(sizeStorage) {
- var valueAxis = this._getValueAxis();
- var argumentAxis = this.getArgumentAxis();
- if (sizeStorage && (sizeStorage.width || sizeStorage.height)) {
- argumentAxis.hideOuterElements();
- var canvas = this._calcCanvas();
- argumentAxis.updateSize(canvas);
- valueAxis.updateSize(canvas)
- }
- },
- checkForMoreSpaceForPanesCanvas: function() {
- return this.layoutManager.needMoreSpaceForPanesCanvas([{
- canvas: this.getArgumentAxis().getCanvas()
- }], this._isRotated())
- },
- _getLayoutTargets: function() {
- return [{
- canvas: this._canvas
- }]
- },
- _getSeriesForPane: function() {
- return this.series
- },
- _applyExtraSettings: _noop,
- _applyPointMarkersAutoHiding: _noop,
- _createScrollBar: _noop,
- _applyClipRects: _noop,
- _isRotated: _noop,
- _getCrosshairOptions: _noop,
- _isLegendInside: _noop
- });
- registerComponent("dxPolarChart", dxPolarChart);
- module.exports = dxPolarChart;
- module.exports.default = module.exports;
|