Hello, When i want to show a datetime object on the x-axis, it starts at 1899.
See the attachment how it looks.
Source code looks like this.
ObservableCollection<Gensys.Widget.ObjectsAndMessages.ObjectsAndMessagesModel.MessageData> col = new ObservableCollection<ObjectsAndMessagesModel.MessageData>();
Steema.TeeChart.WPF.Styles.Bar barSeries;
tchart.Chart.Series.Add(barSeries = new Steema.TeeChart.WPF.Styles.Bar());
barSeries.XValues.DateTime = true;
barSeries.XValues.DataMember = "Date";
barSeries.YValues.DataMember = "TotalTickets";
int counter = 0;
List<MessageData> messageData = _objectsAndMessagesModel.MessageList.Where(m => m.Date == time).ToList();
foreach (MessageData data in messageData)
{
barSeries.Add(data.TotalTickets);
barSeries[counter].Color = GetMessageTypeColor(data.MessageType);
counter++;
col.Add(data);
}
barSeries.DataSource = col;
barSeries.XValues.DataMember = "Date";
I bind to the date property that is located inan other class, but the datacontext is set to an instance of that class and the datasource is set to the observablecollection where data is located.
How can i fix this?
the barchart is selfstacked btw.
Barchart, datetime on x-axis
Barchart, datetime on x-axis
- Attachments
-
- screenieBarChart.png (29.14 KiB) Viewed 5851 times
Re: Barchart, datetime on x-axis
Hello SPS,
I recommend that see on Tutorial number 4 Axis Control.,specifically see in Increment, Where you can find some examples of when to use date times. If it isn't don't hesitate to let us know.
I hope will helps.
Thanks,
I recommend that see on Tutorial number 4 Axis Control.,specifically see in Increment, Where you can find some examples of when to use date times. If it isn't don't hesitate to let us know.
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Barchart, datetime on x-axis
Hello,
thank you for your reply, but i dont think thats the answer, because when i change the multibar to stacked or something else then selfstack, then the x-axis will show the correct dates. But i want i to be set at selfstack. I think it is a bug when using the selfstack option
thank you for your reply, but i dont think thats the answer, because when i change the multibar to stacked or something else then selfstack, then the x-axis will show the correct dates. But i want i to be set at selfstack. I think it is a bug when using the selfstack option
Re: Barchart, datetime on x-axis
Hi SPS,
I've tried to reproduce it with the following code but coudln't:
Could you please modify it until the problem can be reproduced? Or could you send us a simple example project we can run as-is to reproduce the problem here?
I've tried to reproduce it with the following code but coudln't:
Code: Select all
private void InitializeChart()
{
//tChart1.Aspect.View3D = false;
for (int i = 0; i < 5; i++)
{
new Steema.TeeChart.WPF.Styles.Bar(tChart1.Chart);
tChart1[i].XValues.DateTime = true;
tChart1[i].FillSampleValues(5);
}
}
private void button1_Click(object sender, EventArgs e)
{
Steema.TeeChart.WPF.Styles.Bar bar1 = tChart1[0] as Steema.TeeChart.WPF.Styles.Bar;
if (bar1.MultiBar == Steema.TeeChart.WPF.Styles.MultiBars.Stacked)
bar1.MultiBar = Steema.TeeChart.WPF.Styles.MultiBars.Side;
else
bar1.MultiBar = Steema.TeeChart.WPF.Styles.MultiBars.Stacked;
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |