We help IT Professionals succeed at work.

Can I group FusionCharts monthly x-axis labels by year?

SiobhanElara
SiobhanElara asked
on
118 Views
Last Modified: 2016-06-10
I have a chart created in FusionCharts that has data running back 10 years with a point for every month.  Is there a way to have the x-axis labeled only by year? For example,  instead of reading Jan 2010, Feb 2010, etc the area would just say 2010 once, spanning the width of the 12 months?

Thanks!
Comment
Watch Question

RobOwner (Aidellio)
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
You can but it requires you to redo the data yourself. It will not do it internally.

What kind of chart are you creating?

Author

Commented:
It's just a line chart. I added vertical lines for the years but, other than that, nothing fancy (though a bit of the code is in ColdFusion for outputting data.)

  FusionCharts.ready(function(){
    var sentimentChart = new FusionCharts({
        "type": "line",
        "renderAt": "sentimentChartContainer",
        "width": "100%",
        "height": "300",
        "dataFormat": "json",
        "dataSource":  {
          "chart": {
				"caption": "Consumer Sentiment",
				//"subCaption": "Single Family",
				"xAxisName": "Date",
				"yAxisName": "Sentiment",
				"showVLineLabelBorder": "0",
				"theme": "chartTheme"
			}, //end chart
         "data": [
			<cfoutput query="qGetChartData">
				<cfif Month(dataDate) EQ 1>
					{
						//Setting data as vline data
						"vline": "true",
						//Adding label
						"label": "#year(dataDate)#",
						"labelPosition": "0.7",
						"labelHAlign": "left",
						"color": "##ccc"
					},
				</cfif>
				{	
					"label": "#DateFormat(dataDate, 'mmm-yy')#",
					"value": "#sentimentNumber#"
				}<cfif recordCount NEQ currentRow>,</cfif>
			</cfoutput>
          ] //end data
      }

  });
sentimentChart.render();
})

Open in new window

RobOwner (Aidellio)
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
so it's just a matter of redoing your data.  Are you wanting the user to be able to switch between months and years or are you trying to change the chart permanently?

Author

Commented:
Good question. Let's go with switching between, since historically people change their minds once things are done a certain way. ;-)
Owner (Aidellio)
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Fabulous, thank you so much for your help!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.