Get sample name on the x-axis of the chart


Hi,
This the the dataset of my chart I need the sample name on the x axis instead of date

What kind of chart is this? It looks like you are using an xy plot in the place of a category plot.

its a simple vision chart yes seems to me I am using a x-y plot.

image
Switch the chart type to Category.

image
even after doing this its showing the error.

How do you want this chart to look?

I want sample name to be displayed on x axis instead of date

I understand that; have you tried the "Bar Chart" component? The classic chart component is going to try to give you either a date driven domain or a pie chart. Other things are possible using scripting and the configureChart extension function, but it isn't clear to me how you want the data displayed above the names. I don't see any dates or other potential domain axis values in your dataset

we can use date time for filtration but don't want them to be displayed on the chart like if their any mean to do that.


lets consider this as dataset then their any mean to do that

Follow its instruction. Change the renderer to Category after changing the chart type to category.

Also, you probably need to get rid of the empty rows in your dataset.

I'm going to have ask for help, because for some reason, I'm struggling on this one.
I can set the data up like this:
image
...and then create the entire chart from scratch using this button script:

from org.jfree.data.category import DefaultCategoryDataset
from org.jfree.chart import ChartFactory
from org.jfree.chart.plot import PlotOrientation
from org.jfree.chart.renderer.category import LineAndShapeRenderer
chartComponent = event.source.parent.getComponent('Chart')
chart = chartComponent.chart
chartData = chartComponent.Data
catagoryDataset = DefaultCategoryDataset()
for row in range(chartData.rowCount):
	rowData = [chartData.getValueAt(row, column) for column in range(chartData.columnCount)]
	catagoryDataset.addValue(rowData[0], rowData[1], rowData[2])
lineChart = ChartFactory.createLineChart(
	'Sample Values',
	'Samples',
	'Value',
	catagoryDataset,
	PlotOrientation.VERTICAL,
	False,
	False,
	False
)
renderer = LineAndShapeRenderer(True, True)
lineChart.plot.setRenderer(renderer)
chartComponent.chart = lineChart

...and of course, I get the desired result:

...but obviously, this is not the "correct" way, and so far, I haven't found the correct settings in the chart customizer to get this to happen automatically.

1 Like

@arpit_yadav
Happy Cake Day by the way:
image

1 Like

In the Axes tab.


lol

2 Likes

Oof, that's embarrassing. Those icons are also awful... I'll get a ticket going.

1 Like


can we also plot this dataset like can we configure a multiline chart.

To configure a multi line chat, you will need one column that specifies series, so each line will have it's own unique series name that is used to differentiate the data points.