Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Recharts ComposedChart从零开始X轴刻度_Reactjs_Recharts - Fatal编程技术网

Reactjs Recharts ComposedChart从零开始X轴刻度

Reactjs Recharts ComposedChart从零开始X轴刻度,reactjs,recharts,Reactjs,Recharts,我用的是一张合成图,鞋带和线条。通常,直线应从x轴的0开始。但当使用合成图时,却无法做到这一点 如果您在上图中观察到,勾选a应该从x轴(x轴和y轴开始的0点)开始,但不是 这是我正在使用的代码 <ResponsiveContainer width="100%" height="100%"> <ComposedChart width={500} height={400}

我用的是一张合成图,鞋带和线条。通常,直线应从x轴的0开始。但当使用合成图时,却无法做到这一点

如果您在上图中观察到,勾选a应该从x轴(x轴和y轴开始的0点)开始,但不是

这是我正在使用的代码

 <ResponsiveContainer width="100%" height="100%">
          <ComposedChart
            width={500}
            height={400}
            data={[{ count: 0, label: 'a' }, { count: 2, label: 'b' }, { count: 3, label: 'c' }]}
          >
            <CartesianGrid horizontal={false} strokeDasharray="4 4" />
            <XAxis ticks={['a', 'b', 'c']} domain={['dataMin', 'dataMax']} dataKey="label" />
            <YAxis label={{ value: 'No.Of Employees', angle: -90, position: 'insideLeft' }} tick={false} />
            <Tooltip />
            <Bar dataKey="count" barSize={20} fill="#AAE5F9" />
            <Line dot={false} type="monotone" dataKey="count" stroke="#3080ED" />
            {/* <LabelList dataKey="name" position="insideTop" /> */}
          </ComposedChart>
        </ResponsiveContainer>

{/*  */}
我是否可以从X轴的起点(我的意思是从X轴的0点)画出这条线

任何帮助都将是感激的根据本期,您需要在
XAxis中添加
scale=“point”

<XAxis
  ticks={['a', 'b', 'c']}
  domain={['dataMin', 'dataMax']}
  dataKey="label"
  scale="point"
/>