Jump to content
JChartFX Community
  • 0

Need custom X and Y Axis on Line Chart


mishra1982

Question

1 answer to this question

Recommended Posts

  • 0

To change the Y axis labels you have two options

1) Handle an event to change the axis label

var axisY = chart1.getAxisY();
axisY.setNotify(true);
chart1.on("getaxislabel", onAxisLabel);


function onAxisLabel(args)
{
    args.setText("$" + args.getText());
}

2) If the Y axis labels are "finite" you can set the labels and step as follows

    var items = [{"Month":"Jan", "Value":1},{"Month":"Feb", "Value":2},{"Month":"Mar", "Value":3},{"Month":"Apr", "Value":2}];
    chart1.setDataSource(items);
    var axisy = chart1.getAxisY();
    axisy.setStep(1);
    axisy.setLabelValue(1);
    var labels = axisy.getLabels();
    labels.setItem(0, "Bad");
    labels.setItem(1, "Low");
    labels.setItem(2, "Med");
    labels.setItem(3, "Avg");
 

JuanC 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...