o1webdawg Posted February 21, 2014 Report Share Posted February 21, 2014 Hi Everyone, Our developers created all of our charts using the jQuery UI syntax. We are switching our UI framework and now I need to fix all of the broken charts to make them work without jQuery UI. We are still using jQuery, but just not the UI. I am having a very hard time figuring out what part of our javascript is specific to jQuery UI. Can someone tell me how to re-write the following chart code to remove the parts relying on jQuery UI? $("#divname").chart({ gallery: cfx.Gallery.Bar, titles: [{ text: "Monthly Sales - 2014"}], dataValues: monthlylist, axisY : { dataFormat: { format: cfx.AxisFormat.Currency }, labelsFormat: { format: cfx.AxisFormat.Currency } }, animations: { load: { enabled: true } } }); Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted February 22, 2014 Report Share Posted February 22, 2014 To create the chart you would do var chart = new cfx.Chart(); // Configure chart here chart.create("divname") To configure the chart you have 2 choices, you can keep using json notation by using the setOptions method, e.g. chart1.setOptions({ gallery: cfx.Gallery.Bar, ... Or you can use our API, e.g. chart1.setGallery(cfx.Gallery.Bar); chart1.getAllSeries().getPointLabels().setVisible(true); JuanC Quote Link to comment Share on other sites More sharing options...
0 o1webdawg Posted February 22, 2014 Author Report Share Posted February 22, 2014 Thank you very much. That got rid of the error. However, instead of a bar chart I got a line chart. This is what I have now: var chart = new cfx.Chart(); chart.create("<%=DivName%>") chart1.setGallery(cfx.Gallery.Bar); chart1.getAllSeries().getPointLabels().setVisible(true); Why does this look entirely different without jQueryUI? I expected it may not look exactly the same, but I thought it would at least be a bar chart. Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted February 22, 2014 Report Share Posted February 22, 2014 If the variable for the chart you are creating is named chart, you need to change the setGallery and getAllSeries calls from chart1 to chart. Also make sure the create call is the last call you make when creating the chart, to avoid painting the chart from than once. For the chart to look the same as the jQueryUI counterpart you will have to add more api calls to configure the other settings you were changing using the json syntax. JuanC Quote Link to comment Share on other sites More sharing options...
0 o1webdawg Posted February 27, 2014 Author Report Share Posted February 27, 2014 Hi Juan, Thanks for all of your help. I should have noticed the variable was chart1. I fixed that and added all the same options... and it works well! Quote Link to comment Share on other sites More sharing options...
Question
o1webdawg
Hi Everyone,
Our developers created all of our charts using the jQuery UI syntax.
We are switching our UI framework and now I need to fix all of the broken charts to make them work without jQuery UI.
We are still using jQuery, but just not the UI.
I am having a very hard time figuring out what part of our javascript is specific to jQuery UI.
Can someone tell me how to re-write the following chart code to remove the parts relying on jQuery UI?
$("#divname").chart({
gallery: cfx.Gallery.Bar,
titles: [{ text: "Monthly Sales - 2014"}],
dataValues: monthlylist,
axisY : {
dataFormat: {
format: cfx.AxisFormat.Currency
},
labelsFormat: {
format: cfx.AxisFormat.Currency
}
},
animations: {
load: {
enabled: true
}
}
});
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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.