使用 Sencha 图表缩放特定系列
Zooming a specific series with Sencha Charts
我目前有一个 Sencha 折线图,如下所示:
xtype: 'chart',
height: '100%',
store: 'ExperimentDataStore',
axes: [
{
type: 'numeric',
fields: [
'pmc1Value'
],
grid: true,
minimum: 0,
position: 'left',
title: 'PMC1Value'
},
{
type: 'numeric',
fields: [
'temperature'
],
position: 'left',
title: 'test'
},
{
type: 'numeric',
fields: [
'temperature'
],
position: 'left',
title: 'pmc6Value'
},
{
type: 'category',
fields: [
'timestamp'
],
title: 'Name'
}
],
series: [
{
type: 'line',
colors: [
'rgba(0,0,0,0.1)'
],
style: {
smooth: false,
stroke: '#000'
},
xField: 'timestamp',
yField: 'temperature'
},
{
type: 'line',
colors: 'rgba(0,200,0,0.3)',
style: {
smooth: true,
stroke: 'rgb(0,200,0)',
},
xField: 'timestamp',
yField: 'pmc1Value'
}
],
interactions: [
{
type: 'panzoom',
zoomOnPanGesture: true,
axes: {
top: false,
right: false,
bottom: false,
left: true
}
}
]
}
目前,缩放操作会缩放我所有图表系列左侧的 y 轴。但我想要实现的是只缩放一个特定系列而不是所有系列。这能做到吗?
不可以,您不能在单个系列上使用 PanZoom。 PanZoom 交互只能在轴级别而不是系列级别上配置。开箱即用不支持缩放单个系列。
但是假设可以做到,您能否通过放大特定系列来描述您想要的行为?比如你想如何形象化其他系列?你的天平会扭曲。
我目前有一个 Sencha 折线图,如下所示:
xtype: 'chart',
height: '100%',
store: 'ExperimentDataStore',
axes: [
{
type: 'numeric',
fields: [
'pmc1Value'
],
grid: true,
minimum: 0,
position: 'left',
title: 'PMC1Value'
},
{
type: 'numeric',
fields: [
'temperature'
],
position: 'left',
title: 'test'
},
{
type: 'numeric',
fields: [
'temperature'
],
position: 'left',
title: 'pmc6Value'
},
{
type: 'category',
fields: [
'timestamp'
],
title: 'Name'
}
],
series: [
{
type: 'line',
colors: [
'rgba(0,0,0,0.1)'
],
style: {
smooth: false,
stroke: '#000'
},
xField: 'timestamp',
yField: 'temperature'
},
{
type: 'line',
colors: 'rgba(0,200,0,0.3)',
style: {
smooth: true,
stroke: 'rgb(0,200,0)',
},
xField: 'timestamp',
yField: 'pmc1Value'
}
],
interactions: [
{
type: 'panzoom',
zoomOnPanGesture: true,
axes: {
top: false,
right: false,
bottom: false,
left: true
}
}
]
}
目前,缩放操作会缩放我所有图表系列左侧的 y 轴。但我想要实现的是只缩放一个特定系列而不是所有系列。这能做到吗?
不可以,您不能在单个系列上使用 PanZoom。 PanZoom 交互只能在轴级别而不是系列级别上配置。开箱即用不支持缩放单个系列。
但是假设可以做到,您能否通过放大特定系列来描述您想要的行为?比如你想如何形象化其他系列?你的天平会扭曲。