admin管理员组文章数量:1394778
I'm trying to create a chart with goals for some months, but in last month the blue goal does not appear and it exists (you can see in the second image). Why is it happening? How can I fix this?
The red and blue data format is this:
[{
"x":"label",
"y":numericValue,
"goals":[{
"name":"goalLabel",
"value":goalValue,
"strokeHeight":5,
"strokeColor":"rgb(255, 25, 86)"
}]
}]
And the code to create the chart is this:
<Chart
height={350}
options={{
chart: {
toolbar: { show: false },
zoom: { enabled: false }
},
legend: { show: true },
stroke: { show: true, width: 2 },
xaxis: {
type: 'category'
},
yaxis: [
{
axisTicks: {
show: true
},
labels: {
formatter: (value: number) => {
if (value >= 1000000) return (value / 1000000).toFixed(0) + 'M';
if (value >= 1000) return (value / 1000).toFixed(0) + 'K';
return value.toFixed(0);
}
},
seriesName: [strings('dashboard.cash'), strings('dashboard.ca')],
},
{
opposite: true,
labels: {
formatter: (value: number) => {
if (value >= 1000000) return (value / 1000000).toFixed(0) + 'M';
if (value >= 1000) return (value / 1000).toFixed(0) + 'K';
return value.toFixed(0);
},
},
seriesName: strings('dashboard.arpa'),
}
],
tooltip: {
y: {
formatter: (value: number) =>
new Intl.NumberFormat(locale, { style: 'currency', currency: currency }).format(value),
},
},
}}
series={[
{ name: strings('dashboard.cash'), data: cash, type: 'bar', color: 'rgba(215, 66, 106,1)' },
{ name: strings('dashboard.ca'), data: sales, type: 'bar', color: 'rgba(115, 112, 255,1)' },
{ name: strings('dashboard.arpa'), data: arpa, type: 'line', color: 'rgba(238, 204, 0,1)' }
]}
type='line'
width="100%"
/>
Where chart is:
import dynamic from 'next/dynamic';
import { styled } from '@mui/material/styles';
const ApexChart = dynamic(() => import('react-apexcharts'), { ssr: false, loading: () => null });
export const Chart = styled(ApexChart)``;
I'm trying to create a chart with goals for some months, but in last month the blue goal does not appear and it exists (you can see in the second image). Why is it happening? How can I fix this?
The red and blue data format is this:
[{
"x":"label",
"y":numericValue,
"goals":[{
"name":"goalLabel",
"value":goalValue,
"strokeHeight":5,
"strokeColor":"rgb(255, 25, 86)"
}]
}]
And the code to create the chart is this:
<Chart
height={350}
options={{
chart: {
toolbar: { show: false },
zoom: { enabled: false }
},
legend: { show: true },
stroke: { show: true, width: 2 },
xaxis: {
type: 'category'
},
yaxis: [
{
axisTicks: {
show: true
},
labels: {
formatter: (value: number) => {
if (value >= 1000000) return (value / 1000000).toFixed(0) + 'M';
if (value >= 1000) return (value / 1000).toFixed(0) + 'K';
return value.toFixed(0);
}
},
seriesName: [strings('dashboard.cash'), strings('dashboard.ca')],
},
{
opposite: true,
labels: {
formatter: (value: number) => {
if (value >= 1000000) return (value / 1000000).toFixed(0) + 'M';
if (value >= 1000) return (value / 1000).toFixed(0) + 'K';
return value.toFixed(0);
},
},
seriesName: strings('dashboard.arpa'),
}
],
tooltip: {
y: {
formatter: (value: number) =>
new Intl.NumberFormat(locale, { style: 'currency', currency: currency }).format(value),
},
},
}}
series={[
{ name: strings('dashboard.cash'), data: cash, type: 'bar', color: 'rgba(215, 66, 106,1)' },
{ name: strings('dashboard.ca'), data: sales, type: 'bar', color: 'rgba(115, 112, 255,1)' },
{ name: strings('dashboard.arpa'), data: arpa, type: 'line', color: 'rgba(238, 204, 0,1)' }
]}
type='line'
width="100%"
/>
Where chart is:
import dynamic from 'next/dynamic';
import { styled } from '@mui/material/styles';
const ApexChart = dynamic(() => import('react-apexcharts'), { ssr: false, loading: () => null });
export const Chart = styled(ApexChart)``;
Share Improve this question edited Mar 28 at 20:30 Olivier Tassinari 8,6916 gold badges25 silver badges28 bronze badges asked Mar 27 at 10:52 user3292323user3292323 1611 gold badge3 silver badges8 bronze badges
1 Answer
Reset to default 1I've solved by changing chart type line, to bar. In line mode the center is the value point, and in the bar mode, there is a range in each value
本文标签: material uiTwo column ApexChart does not show all goalsStack Overflow
版权声明:本文标题:material ui - Two column ApexChart does not show all goals - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744095127a2590146.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论