Skip to main content
New Participant
October 20, 2022
Question

column chart

  • October 20, 2022
  • 2 replies
  • 2 views

If the column touches the highest value on y axis I want the Y axis to be increased by a value so as there is space above

For eg if the values are 5,10,15,20,25...
and the column touches 25
I want the y-axis to be at 30

2 replies

amans0009
Participating Frequently
October 20, 2022

try this 

a!localVariables(
  local!data:{3,2,13,0,21,11},
  local!yIncrease:1,
  {
  a!columnChartField(
    label: "Column Chart",
    categories: {"Category 1", "Category 2", "Category 3"},
    series: {
      a!chartSeries(label: "Chart Series", data: local!data)
    },
    stacking: "NONE",
    showLegend: true,
      showTooltips: true,
    labelPosition: "ABOVE",
    colorScheme: "CLASSIC",
    height: "MEDIUM",
    xAxisStyle: "STANDARD",
    yAxisStyle: "STANDARD",
    yAxisMax: max(local!data)+local!yIncrease
  )
}
)

amans0009
Participating Frequently
October 20, 2022

and if ou want  to keep yMax at 25 and then you want it to increase according to the data then try this 

a!localVariables(
  local!data:{3,2,13,0,21,11},
  local!yMax:10,
  local!yIncrease:1,
  {
  a!columnChartField(
    label: "Column Chart",
    categories: {"Category 1", "Category 2", "Category 3"},
    series: {
      a!chartSeries(label: "Chart Series", data: local!data)
    },
    stacking: "NONE",
    showLegend: true,
      showTooltips: true,
    labelPosition: "ABOVE",
    colorScheme: "CLASSIC",
    height: "MEDIUM",
    xAxisStyle: "STANDARD",
    yAxisStyle: "STANDARD",
    yAxisMax: if(max(local!data)>=local!yMax,max(local!data)+local!yIncrease,local!yMax)
  )
}
)