Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use the ticks-labels attribute defined in the Documentation #139

Open
1quest opened this issue Apr 10, 2024 · 0 comments
Open

Comments

@1quest
Copy link

1quest commented Apr 10, 2024

What is affected by this bug?

Bar charts, when adding a secondary category-axis. Doesn't seem to follow the documentation (https://salesforcelabs.github.io/LightningWebChartJS/docs/api/axes/cartesian/category.html) as the ticks-labels aren't used?

Where on the platform does it happen?

On a ServiceMax page on the Installed Product, under IB Technical Attribute

How do we replicate the issue?

I have a LWC defined as below, first the html-part

<c-sample-app-item>
  <c-chart slot="chartExample" type="bar" responsive="true">
	<c-dataset labels='["21;-One","Two","23;-One","Two","24;-One","Two","22-One","Two"]'>
	  <c-data label="OK" detail="[17,17,16,16,17,17,16,17]" backgroundcolor='rgba(50, 150, 237, 1)' stack="1" categorypercentage=1></c-data>
	  <c-data label="Flagged" detail="[0,0,1,0,1,0,1,0]" backgroundcolor='rgba(119, 185, 242, 1)' stack="1" categorypercentage=1></c-data>
	  <c-data label="NOK" detail="[17,17,17,16,19,18,17,17]" backgroundcolor='rgba(157, 83, 242, 1)' stack="1" categorypercentage=1></c-data>
	</c-dataset>
	<c-cartesian-category-axis 
	  axis="x" 
	  stacked="true" 
	  position="bottom" 
	  type="category">
	</c-cartesian-category-axis> 
	<c-cartesian-category-axis 
	  axis="x"  
	  position="top"
// These aren't visible/used anywhere in the chart visualization as-is, but still pull the labels from the dataset
	  ticks-labels='["21","23","24","22"]'
	>
	</c-cartesian-category-axis>  
	<c-cartesian-axis 
	  axis="y" 
	  stacked="true">
	</c-cartesian-axis>
	<c-title 
	  text="Curve controls"></c-title>
	<c-legend 
	  position="right"></c-legend>
  </c-chart>
</c-sample-app-item>

The output looks like this

Expected behavior (i.e. solution)

What it looks like now:
chart_current

The ticks-labels should allow a secondary axis to be included, with defined labels from the script. The end-goal is to remove the "21","23,"24","22" from the data labels of the stacks themselves and instead be grouped in four "overall stacks"

According to documentation (https://salesforcelabs.github.io/LightningWebChartJS/docs/api/axes/cartesian/category.html) the ticks-labels should do the trick, with some adjustments to offset, but currently its just showing the dataset labels for the second axis as well.

The goal is to have it look like this in the end
chart_goal

Other Comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant