enh(echarts): Support custom ticklabel formatter
Resolves https://github.com/holoviz/panel/issues/7936
This could be generalized to a custom model. Currently, this is hardcoded to this one instance.
Details
import panel as pn
pn.extension("echarts")
code_js = """
(value) => {
if (value === -180) {
return '';
}
return value + '';
}
"""
w1 = pn.indicators.Gauge(
name="Roll",
value=0,
start_angle=-90,
end_angle=270,
bounds=(-180, 180),
format="{value} Degs",
colors=[(0.25, "red"), (0.75, "green"), (1, "red")],
custom_opts={
"splitNumber": 12,
"axisLabel": {"formatter": code_js},
},
)
code_js = """
(value) => {
if (value === 360) {
return '';
}
return value + '';
}
"""
w2 = pn.indicators.Gauge(
name="Heading",
value=0,
start_angle=90,
end_angle=-270,
bounds=(0, 360),
format="{value} Degs",
custom_opts={
"splitNumber": 12,
"labelLayout": {"hideOverlap": True},
"axisLabel": {"formatter": code_js},
},
)
pn.Row(w1, w2).servable()
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 86.09%. Comparing base (dec3707) to head (5f1be8e).
:warning: Report is 139 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #7940 +/- ##
==========================================
- Coverage 87.12% 86.09% -1.03%
==========================================
Files 346 346
Lines 53225 53225
==========================================
- Hits 46372 45826 -546
- Misses 6853 7399 +546
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Superseded by #8162
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.