combobox data binding questionhttps://forum.zkoss.orgA highly productive open source Java framework for building amazing enterprise web and mobile applications.enCopyright Potix Corporation 2015.Tue, 02 May 2023 23:14:25 +0800charts: align two opposite y-axis around zerohttps://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/Hi all,
I added in my chart two opposite y-axis.
They have different ticks, the ticks automatically generated are ok for me, but I need that the zero is aligned for both axis.
Is it possible?
Thanks in advance.
Tue, 21 Mar 2023 22:09:16 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/Answer by jeanher for charts: align two opposite y-axis around zero https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114730#post-id-114730Hi, are you using ZK Charts or another charting component?
What type of chart is it?
We have increased your karma. Please provide more information and a screenshot so that we can understand you better and provide suggestions.Tue, 28 Mar 2023 00:07:50 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114730#post-id-114730Answer by teresa for charts: align two opposite y-axis around zero https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114731#post-id-114731Hi all,
thanks in advance for your support.
I attach an image.
I need that the x axis is the same for both y-axes. Is it possible?
Regards,
Teresa!Tue, 28 Mar 2023 00:48:58 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114731#post-id-114731Answer by teresa for charts: align two opposite y-axis around zero https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114732#post-id-114732Hi all,
thanks in advance for your support.
I attach an image.
I need that x-axis (the zero level: y=0) is the same for both y-axes. Is it possible?
Regards,
![image description](/upfiles/1679936979413724.png)Tue, 28 Mar 2023 01:10:20 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114732#post-id-114732Answer by hawk for charts: align two opposite y-axis around zero https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114738#post-id-114738I don't find an option to make the x-axis start from 0 and show negative values at the same time.
But there is an option to make 2 y-axis have the same values like:
![image description](/upfiles/168075478676486.png)
public class LinkedYAxisComposer extends SelectorComposer<Component> {
@Wire
Charts chart;
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
// Create a predefined implementation category model
CategoryModel model = new DefaultCategoryModel();
// Set value to the model
model.setValue("Tokyo", "Spring", new Integer(11));
model.setValue("Tokyo", "Summer", new Integer(8));
model.setValue("Tokyo", "Fall", new Integer(-2));
model.setValue("Tokyo", "Winter", new Integer(-10));
model.setValue("New York", "Spring", new Integer(30));
model.setValue("New York", "Summer", new Integer(18));
model.setValue("New York", "Fall", new Integer(20));
model.setValue("New York", "Winter", new Integer(22));
// Set model to the chart
chart.setModel(model);
chart.getYAxis().setMin(-10);
//right y-axis
YAxis yAxisRight = chart.getYAxis(1);
//When an axis is linked to a master axis, it will take the same extremes as the master, but as assigned by min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.
yAxisRight.setLinkedTo(0);
yAxisRight.setOpposite(true);
yAxisRight.getLabels().setEnabled(true);
yAxisRight.setTitle("Different Values");
}
}Thu, 06 Apr 2023 12:21:22 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114738#post-id-114738Answer by teresa for charts: align two opposite y-axis around zero https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114769#post-id-114769Thanks for your help.Tue, 02 May 2023 23:14:25 +0800https://forum.zkoss.org/question/114723/charts-align-two-opposite-y-axis-around-zero/?answer=114769#post-id-114769