I am trying to draw a chart with two axis, using data that i am pulling with SQL. i see the data is coming though but i keep getting an error.
i want the x axis to show the string name, while the y axis show the data.
is it not possible to have string for the x axis?
That is the case for the Chart component when you are using the “XY Plot” for the Chart Type. It sounds like you may want to use a category axis.
Chart Type: XY vs Category
The classic chart is typically in XY Plot mode. This means that the X-axis is either date or numeric, and the Y-axes are numeric. If your X-axis is categorical (names, not numbers), you can switch the Chart Type property to Category Chart in the Property Editor. Don’t be surprised when you get a few errors - you’ll need to go and switch your X-axis to be a Category Axis, and fill your dataset in with valid category data, that is, String-based X-values. This is most often used with the Bar Renderer (see the Vision - Chart Customizer).
Thank you for your help, so i made a category axis for the x axis, so the error is gone, but i am not seeing any data, its just blank. the data works when i try to do a bar chart, but i need this in a XY format with 2 y-axis, which i have added.
@stat on a side note, is there a feature where the chart would give an option to add data from one dataset to two y-axis? instead of needing two datasets to get the 2nd axis ?
You can’t get an axis which isn’t assigned to a dataset to show. And as far as I’m aware you can’t add more than one range or domain axis to a dataset.
Nothing says that a dataset has to actually have data in it though. So adding a dataset and then assigning the additional axis to it will make it show. That axis will not auto range though, so you will have to take care of that either through scripting or through a fixed range.
You could also just use the same data in both datasets, but that may have unintended consequences.
You could use the expression function
columnRearrange on two additional datasets to ‘split’ the source dataset to render them separately.