Skip to content

Commit

Permalink
Merge branch 'master' into feat-pictorialBar-clip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Nov 8, 2023
2 parents 0edce2a + fd9e62d commit 71799e9
Show file tree
Hide file tree
Showing 33 changed files with 1,103 additions and 467 deletions.
780 changes: 382 additions & 398 deletions package-lock.json

Large diffs are not rendered by default.

56 changes: 18 additions & 38 deletions src/chart/sunburst/SunburstPiece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,20 @@ class SunburstPiece extends graphic.Sector {
let r;
const labelPadding = getLabelAttr(labelStateModel, 'distance') || 0;
let textAlign = getLabelAttr(labelStateModel, 'align');
const rotateType = getLabelAttr(labelStateModel, 'rotate');
const flipStartAngle = Math.PI * 0.5;
const flipEndAngle = Math.PI * 1.5;
const midAngleNormal = normalizeRadian(rotateType === 'tangential' ? Math.PI / 2 - midAngle : midAngle);

// For text that is up-side down, rotate 180 degrees to make sure
// it's readable
const needsFlip = midAngleNormal > flipStartAngle
&& !isRadianAroundZero(midAngleNormal - flipStartAngle)
&& midAngleNormal < flipEndAngle;

if (labelPosition === 'outside') {
r = layout.r + labelPadding;
if (layout.clockwise) {
textAlign = midAngle > Math.PI / 2 ? 'right' : 'left';
}
else {
textAlign = midAngle > -Math.PI * 3 / 2 ? 'right' : 'left';
}
textAlign = needsFlip ? 'right' : 'left';
}
else {
if (!textAlign || textAlign === 'center') {
Expand All @@ -237,29 +243,11 @@ class SunburstPiece extends graphic.Sector {
}
else if (textAlign === 'left') {
r = layout.r0 + labelPadding;
if (layout.clockwise) {
if (midAngle > Math.PI / 2 && !isRadianAroundZero(midAngle - Math.PI / 2)) {
textAlign = 'right';
}
}
else {
if (midAngle > -Math.PI * 3 / 2 && !isRadianAroundZero(midAngle - Math.PI / 2)) {
textAlign = 'right';
}
}
textAlign = needsFlip ? 'right' : 'left';
}
else if (textAlign === 'right') {
r = layout.r - labelPadding;
if (layout.clockwise) {
if (midAngle > Math.PI / 2 && !isRadianAroundZero(midAngle - Math.PI / 2)) {
textAlign = 'left';
}
}
else {
if (midAngle > -Math.PI * 3 / 2 && !isRadianAroundZero(midAngle - Math.PI / 2)) {
textAlign = 'left';
}
}
textAlign = needsFlip ? 'left' : 'right';
}
}

Expand All @@ -269,22 +257,14 @@ class SunburstPiece extends graphic.Sector {
state.x = r * dx + layout.cx;
state.y = r * dy + layout.cy;

const rotateType = getLabelAttr(labelStateModel, 'rotate');
let rotate = 0;
if (rotateType === 'radial') {
rotate = normalizeRadian(-midAngle);
if (((rotate > Math.PI / 2 && rotate < Math.PI * 1.5))) {
rotate += Math.PI;
}
rotate = normalizeRadian(-midAngle)
+ (needsFlip ? Math.PI : 0);
}
else if (rotateType === 'tangential') {
rotate = Math.PI / 2 - midAngle;
if (rotate > Math.PI / 2) {
rotate -= Math.PI;
}
else if (rotate < -Math.PI / 2) {
rotate += Math.PI;
}
rotate = normalizeRadian(Math.PI / 2 - midAngle)
+ (needsFlip ? Math.PI : 0);
}
else if (zrUtil.isNumber(rotateType)) {
rotate = rotateType * Math.PI / 180;
Expand Down
6 changes: 5 additions & 1 deletion src/component/tooltip/TooltipHTMLContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ class TooltipHTMLContent {
}

dispose() {
this.el.parentNode.removeChild(this.el);
clearTimeout(this._hideTimeout);
clearTimeout(this._longHideTimeout);

const parentNode = this.el.parentNode;
parentNode && parentNode.removeChild(this.el);
this.el = this._container = null;
}

Expand Down
13 changes: 6 additions & 7 deletions src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,19 @@ class ECharts extends Eventful<ECEventDefinition> {
let defaultRenderer = 'canvas';
let defaultCoarsePointer: 'auto' | boolean = 'auto';
let defaultUseDirtyRect = false;

if (__DEV__) {
const root = (
/* eslint-disable-next-line */
env.hasGlobalWindow ? window : global
) as any;

defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;

defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer);
if (root) {
defaultRenderer = retrieve2(root.__ECHARTS__DEFAULT__RENDERER__, defaultRenderer);
defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer);
defaultUseDirtyRect = retrieve2(root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__, defaultUseDirtyRect);
}

const devUseDirtyRect = root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__;
defaultUseDirtyRect = devUseDirtyRect == null
? defaultUseDirtyRect
: devUseDirtyRect;
}

const zr = this._zr = zrender.init(dom, {
Expand Down
147 changes: 147 additions & 0 deletions src/i18n/langAR.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* Language: Arabic.
*/

export default {

time: {
month: [
'يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو',
'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'
],
monthAbbr: [
'يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو',
'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'
],
dayOfWeek: [
'الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'
],
dayOfWeekAbbr: [
'الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'
]
},
legend: {
selector: {
all: 'تحديد الكل',
inverse: 'عكس التحديد'
}
},
toolbox: {
brush: {
title: {
rect: 'تحديد صندوقي',
polygon: 'تحديد حلقي',
lineX: 'تحديد أفقي',
lineY: 'تحديد عمودي',
keep: 'الاحتفاظ بالمحدد',
clear: 'إلغاء التحديد'
}
},
dataView: {
title: 'عرض البيانات',
lang: ['عرض البيانات', 'إغلاق', 'تحديث']
},
dataZoom: {
title: {
zoom: 'تكبير',
back: 'استعادة التكبير'
}
},
magicType: {
title: {
line: 'خطوط',
bar: 'أشرطة',
stack: 'تكديس',
tiled: 'مربعات'
}
},
restore: {
title: 'استعادة'
},
saveAsImage: {
title: 'حفظ كملف صورة',
lang: ['للحفظ كصورة انقر بالزر الأيمن']
}
},
series: {
typeNames: {
pie: 'رسم بياني دائري',
bar: 'رسم بياني شريطي',
line: 'رسم بياني خطي',
scatter: 'نقاط مبعثرة',
effectScatter: 'نقاط مبعثرة متموجة',
radar: 'رسم بياني راداري',
tree: 'شجرة',
treemap: 'مخطط شجري',
boxplot: 'مخطط صندوقي',
candlestick: 'مخطط شمعدان',
k: 'رسم بياني خطي من النوع K',
heatmap: 'خريطة حرارية',
map: 'خريطة',
parallel: 'خريطة الإحداثيات المتناظرة',
lines: 'خطوط',
graph: 'مخطط علائقي',
sankey: 'مخطط ثعباني',
funnel: 'مخطط هرمي',
gauge: 'مقياس',
pictorialBar: 'مخطط مصوّر',
themeRiver: 'نمط خريطة النهر',
sunburst: 'مخطط شمسي',
custom: 'مخطط مخصص',
chart: 'مخطط'
}
},
aria: {
general: {
withTitle: 'هذا رسم بياني حول "{title}".',
withoutTitle: 'هذا رسم بياني.'
},
series: {
single: {
prefix: '',
withName: ' من النوع {seriesType} اسمه {seriesName}.',
withoutName: ' من النوع {seriesType}.'
},
multiple: {
prefix: '. يتكون من {seriesCount} سلسلة.',
withName: ' الـ {seriesId} هي سلسلة من النوع {seriesType} تستعرض {seriesName}.',
withoutName: ' الـ {seriesId} هي سلسلة من النوع {seriesType}.',
separator: {
middle: '، ',
end: '. '
}
}
},
data: {
allData: 'البيانات هي كالتالي: ',
partialData: 'أول {displayCnt} عناصر هي: ',
withName: 'قيمة العنصر {name} هي {value}',
withoutName: '{value}',
separator: {
middle: '، ',
end: '. '
}
}
}


};
4 changes: 3 additions & 1 deletion src/i18n/langCS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
gauge: 'Indikátor',
pictorialBar: 'Obrázkový sloupcový graf',
themeRiver: 'Theme River Map',
sunburst: 'Vícevrstvý prstencový graf'
sunburst: 'Vícevrstvý prstencový graf',
custom: 'Graficu persunalizatu',
chart: 'Graf'
}
},
aria: {
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/langDE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export default {
gauge: 'Meßanzeige',
pictorialBar: 'Bildlicher Balken',
themeRiver: 'Thematische Flusskarte',
sunburst: 'Sonnenausbruch'
sunburst: 'Sonnenausbruch',
custom: 'Graficu persunalizatu',
chart: 'Diagramm'
}
},
aria: {
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/langEN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export default {
gauge: 'Gauge',
pictorialBar: 'Pictorial bar',
themeRiver: 'Theme River Map',
sunburst: 'Sunburst'
sunburst: 'Sunburst',
custom: 'Custom chart',
chart: 'Chart'
}
},
aria: {
Expand Down
60 changes: 60 additions & 0 deletions src/i18n/langES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,65 @@ export default {
title: 'Guardar como imagen',
lang: ['Clic derecho para guardar imagen']
}
},
series: {
typeNames: {
pie: 'Gráfico circular',
bar: 'Gráfico de barras',
line: 'Gráfico de líneas',
scatter: 'Diagrama de dispersión',
effectScatter: 'Diagrama de dispersión de ondas',
radar: 'Gráfico de radar',
tree: 'Árbol',
treemap: 'Mapa de árbol',
boxplot: 'Diagrama de caja',
candlestick: 'Gráfico de velas',
k: 'Gráfico de líneas K',
heatmap: 'Mapa de calor',
map: 'Mapa',
parallel: 'Mapa de coordenadas paralelas',
lines: 'Gráfico de líneas',
graph: 'Gráfico de relaciones',
sankey: 'Diagrama de Sankey',
funnel: 'Gráfico de embudo',
gauge: 'Medidor',
pictorialBar: 'Gráfico de barras pictóricas',
themeRiver: 'Mapa de río temático',
sunburst: 'Sunburst',
custom: 'Gráfico personalizado',
chart: 'Gráfico'
}
},
aria: {
general: {
withTitle: 'Este es un gráfico sobre “{title}”',
withoutTitle: 'Este es un gráfico'
},
series: {
single: {
prefix: '',
withName: ' con tipo {seriesType} llamado {seriesName}.',
withoutName: ' con tipo {seriesType}.'
},
multiple: {
prefix: '. Consta de {seriesCount} series.',
withName: ' La serie {seriesId} es un {seriesType} que representa {seriesName}.',
withoutName: ' La serie {seriesId} es un {seriesType}.',
separator: {
middle: '',
end: ''
}
}
},
data: {
allData: 'Los datos son los siguientes: ',
partialData: 'Los primeros {displayCnt} elementos son: ',
withName: 'los datos para {name} son {value}',
withoutName: '{value}',
separator: {
middle: ', ',
end: '. '
}
}
}
};
Loading

0 comments on commit 71799e9

Please sign in to comment.