User (Legacy) Posted October 8, 2003 Report Share Posted October 8, 2003 Hi , I'm trying to change the X-Axis label format in JavaScript, but am having no luck. When the chart is generated in VB, the datetime format for the chart I'm working on defaults to yyyy-MM-dd, ie chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" In JavaScript, I'm trying: myChart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd HH:mm"; OR myChart.Axis.Item(2).LabelsFormat.CustomFormat = "yyyy-MM-dd HH:mm"; but nothing happens (no errors or nothing). Is there a trick to changing the label formats in JavaScript? Thanks, -Sean Link to comment Share on other sites More sharing options...
Software FX Posted October 9, 2003 Report Share Posted October 9, 2003 The following code works for me (JScript): Chart1.AxisX.LabelsFormat.Format = 5; // Date Chart1.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" Notice that if you are using MainClient = true, the object in the object tag is a "wrapper" not the chart itself. To access the chart use the "Chart" property as follows: Chart1.Chart.AxisX.LabelsFormat.Format = 5; Chart1.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 9, 2003 Author Report Share Posted October 9, 2003 Alright, I must still be doing something wrong. I'll try giving you a little more detail. This is the VB code I use to initially set the date format: chart.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Date chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" After the chart is generated, I have some buttons that can be used to further customize the chart. One is to toggle the hours and minutes on and off. The JavaScript I use to handle this is: function toggleTimeLabels (on) { if (on) { profile.myChart.Chart.AxisX.LabelsFormat.Format = 8; profile.myChart.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd HH:mm"; }//if else { profile.myChart.Chart.AxisX.LabelsFormat.Format = 5; profile.myChart.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd"; } }//toggleTimeLabels The JavaScript executes without error, but the only thing that happens on my chart, is one more date label gets added on the left hand side of the chart (pushing the others over at the same time), but no hours/minutes actually show up on the labels. I know the date/time values that I'm initially using to populate the chart contain time values. Thanks, -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:np8$4HmjDHA.3600@WEBSERVER1... > The following code works for me (JScript): > > Chart1.AxisX.LabelsFormat.Format = 5; // Date > Chart1.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > Notice that if you are using MainClient = true, the object in the object tag > is a "wrapper" not the chart itself. To access the chart use the "Chart" > property as follows: > > Chart1.Chart.AxisX.LabelsFormat.Format = 5; > Chart1.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 9, 2003 Author Report Share Posted October 9, 2003 What type of date objects should I be passing to the chart? System.DateTime objects or SqlTypes.SqlDateTime objects, etc. ? -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:np8$4HmjDHA.3600@WEBSERVER1... > The following code works for me (JScript): > > Chart1.AxisX.LabelsFormat.Format = 5; // Date > Chart1.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > Notice that if you are using MainClient = true, the object in the object tag > is a "wrapper" not the chart itself. To access the chart use the "Chart" > property as follows: > > Chart1.Chart.AxisX.LabelsFormat.Format = 5; > Chart1.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 9, 2003 Author Report Share Posted October 9, 2003 I found my problem. Didn't realize the the values for the X-Axis need to be of 'XValue' datatype and not 'Label' datatype. -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:np8$4HmjDHA.3600@WEBSERVER1... > The following code works for me (JScript): > > Chart1.AxisX.LabelsFormat.Format = 5; // Date > Chart1.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > Notice that if you are using MainClient = true, the object in the object tag > is a "wrapper" not the chart itself. To access the chart use the "Chart" > property as follows: > > Chart1.Chart.AxisX.LabelsFormat.Format = 5; > Chart1.Chart.AxisX.LabelsFormat.CustomFormat = "yyyy-MM-dd" > > > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.