Skip to content

Commit

Permalink
cnmap style
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Mar 23, 2024
1 parent 1d3cd39 commit c27db8a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/main/resources/web/assets/css/chart-design.css
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,19 @@ a.ui-draggable.ui-draggable-dragging {
margin-left: 5px;
}

.J_opt-DATALIST2 input {
.J_opt-DATALIST2 input,
.J_opt-CNMAP select {
border: 0 none;
outline: 0 none;
width: 50px;
width: 66px;
border-bottom: 1px solid #ccc;
padding: 2px;
margin-left: 5px;
text-align: center;
}

.J_opt-DATALIST2 input:focus {
.J_opt-DATALIST2 input:focus,
.J_opt-CNMAP select:focus {
border-color: #4285f4;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/web/assets/js/charts/chart-design.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ $(document).ready(() => {

$('.chart-option .custom-control').on('click', () => render_option())
$('.chart-option input[type="text"]').on('blur', () => render_option())
$('.chart-option select').on('change', () => render_option())

// 保存按钮
$('.rb-toggle-left-sidebar')
Expand Down Expand Up @@ -447,7 +448,7 @@ const build_config = () => {
cfg.axis = { dimension: dims, numerical: nums }

const option = {}
$('.chart-option input').each(function () {
$('.chart-option input, .chart-option select').each(function () {
const name = $(this).data('name')
if (name) option[name] = $val(this)
})
Expand Down
9 changes: 4 additions & 5 deletions src/main/resources/web/assets/js/charts/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1343,14 +1343,13 @@ class ChartCNMap extends BaseChart {

const elid = `echarts-cnmap-${this.state.id || 'id'}`
this.setState({ chartdata: <div className="chart cnmap" id={elid} /> }, () => {
const mapTheme = data._renderOption && data._renderOption.mapTheme

const data4map = []
data.data.forEach((item) => {
let lnglat = item[1].split(',')
data4map.push([lnglat[0], lnglat[1], item[2] || null, item[0]])
})

const mapTheme = data._renderOption && data._renderOption.themeStyle
const hasNumAxis = data.name ? true : false

// https://github.com/apache/echarts/tree/master/extension-src/bmap
Expand All @@ -1364,7 +1363,7 @@ class ChartCNMap extends BaseChart {
enableMapClick: false,
},
mapStyle: {
styleJson: mapTheme === 'dark' ? MAP_STYLE2 : MAP_STYLE1,
styleJson: mapTheme === 'dark' ? MAP_STYLE2 : mapTheme === 'light' ? MAP_STYLE1 : [],
},
},
series: [
Expand All @@ -1374,7 +1373,7 @@ class ChartCNMap extends BaseChart {
symbol: data.name ? 'circle' : 'pin',
symbolSize: function (v) {
console.log(v)
return hasNumAxis ? 14 : 18
return hasNumAxis ? 14 : 20
},
data: data4map,
encode: {
Expand All @@ -1394,7 +1393,7 @@ class ChartCNMap extends BaseChart {
if (data.name) {
return `<b>${a.data[3]}</b> <br/> ${a.marker} ${data.name} : ${formatThousands(a.data[2])}`
} else {
return `${a.data[3]}`
return `<b>${a.data[3]}</b>`
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/web/assets/js/rb-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -1276,13 +1276,8 @@ const renderRbcomp = function (JSX, container, callback, v18) {
return container
}

// for: React v18
const renderRbcomp18 = function (JSX, container) {
return renderRbcomp(JSX, container, null, true)
}

const __DLGCOMPS = {}
// 渲染可重用组件
const __DLGCOMPS = {}
const renderDlgcomp = function (JSX, id) {
if (__DLGCOMPS[id]) {
__DLGCOMPS[id].show()
Expand All @@ -1292,3 +1287,8 @@ const renderDlgcomp = function (JSX, id) {
})
}
}

// for: React v18
const renderRbcomp18 = function (JSX, container) {
return renderRbcomp(JSX, container, null, true)
}
8 changes: 8 additions & 0 deletions src/main/resources/web/dashboard/chart-design.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ <h5>[[${bundle.L('图表选项')}]]</h5>
<label style="color: #444">[[${bundle.L('最大显示条数')}]]</label>
<input type="text" data-name="pageSize" placeholder="40" maxlength="4" />
</div>
<div class="hide J_opt-CNMAP">
<label style="color: #444">[[${bundle.L('样式')}]]</label>
<select data-name="themeStyle">
<option value="">[[${bundle.L('默认')}]]</option>
<option value="dark">[[${bundle.L('深色')}]]</option>
<option value="light">[[${bundle.L('浅色')}]]</option>
</select>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit c27db8a

Please sign in to comment.