Hi,
This may seem very complex but I will try to make it as simple as possible. I am trying to draw a composite chart where the top layer is a Gantt Chart and the bottom layer is a Line Chart. Both the charts need to share the same X Axis. However, the line chart has multiple Y Axis due to which the width of the X Axis reduces. It looks something like this,
I counted the number of Y axis in the Line chart and created equal number of Y axis for the Gantt Charts and made then invisible. That worked for until 2 Y axis but not after that the Gantt chart does not seem to shift. Is there any way in which I can coincide these axis? How many Y Axis can we add to a gantt chart.
Moreover, for the GanttDataSource, I have created a Gantt Series and every new line is a new Task added to that series. Can I make the color change for the bars on the same line? Can 2 TaskItems be added on a same line?
I worked with this datasource on a separate Gantt Chart and I could set the property ShowOwner = true to see the owners. However , after making it a composite chart I cannot see the owners even after setting the properties.
Can you please help?
Thanks,
Ketaki
The space between the Y axis and the left edge of the chart area is controlled by the Extent property, not the number of axes you have, so lining up the axes on 2 chart areas is actually quite simple. Setting Extent property on your Y axis (it's 80 pixels by default) to something like 130 should give you a good result. You should be able to get perfect alignment with some trial and error. Remember to set Extent on the AxisItem instance in ChartArea.Axes collection, not on UltraWinChart.Axis.Y.
2 tasks cannot be added to the same line. However, each GanttItem has a Times collection. Each time entry in the times collection is placed on the same line and has a PE property, so it can be set to any color. Tasks also have a PE property and can also be set to any color.
Make sure you're setting ShowOwners on the chart appearance object instead of UltraWinChart.GanttChart. The former has no effect in composite charts. For example, this is how you can set ShowOwners in a composite chart:ChartLayerAppearance layer = new ChartLayerAppearance();layer.ChartType = ChartType.GanttChart;GanttChartAppearance appearance = new GanttChartAppearance();appearance.ShowOwners = true;layer.ChartTypeAppearance = appearance;
Thanks. It worked. I have one more problem. I need the dates on the Gantt Charts to be the same as the ones in the line chart below. Is there any way in which I can customize the dates to be the same. I tried to make the X Axis common but the datatype for the line charts in set to String and Gantt Charts only require Time. Is there a way in which I can change it from String to Time. What should I change to get the Axis datatype for the line charts to be Time? If I change the datatype to Time directly, the line graph does not show up.
The tooltip modified in this case changes the tool tip for the whole chart (the line and the gantt). So this wont work for me.
However, I have done something things similar to http://community.infragistics.com/forums/p/17397/67982.aspx#67982 to get separated tool tips.
I have added a unique string to each GanttTimeEntry.Label. How can I show this in the tool tip. I am catching the event using a DataItemOver for rendering the tooltip.
The ChartDataEventArgs e has parameters datavalue, columnLabel,Rowlabel etc. These are values coming from a DataColumn. How can I get the Gantt Chart string in these values since I am not using a Data Table but a Gantt Data Source.
Moreover, in the function
public string ToString(Hashtable Context)
{
return Context["DATA_VALUE"].ToString() + "Unique ;
}
are there any other Context[" ???? "] that I can use to get the string in there.
The contents of the context hashtable are different for different data points, so the best way to see those contents is to place a break point in the ToString method and explore the hashtable through the debugger.
If you're using DataItemOver, you don't really need to use a label renderer. You can set the tooltip explicitly in that event:private void ultraChart1_DataItemOver(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e){ GanttItem item = e.Primitive.DataPoint as GanttItem; int index = (int) e.Primitive.Tags["TIME_ENTRY_INDEX"]; string tooltip = item.Times[index].Label; ultraChart1.Tooltips.FormatString = tooltip;}
It's also a good idea to reset the format string back to what it was in DataItemOut event, since you are changing the tooltip for the entire chart.
Thanks a lot. That worked, but the text lines I am putting inside the tooltip are all centered. Can I have them formatted. I am wondering if I can add the UltraToolTipManager to the top chart. Can you please tell me how can I achieve this one? I have never worked with the UltratooltipManager
I am not understanding how I am supposed to add the UltratooltipManager in place of the default tooltips. Moreover How do I put my text for formatting in the UltratooltipManager.
I was able to use the UltraTooltipManager for the tool tips. Thanks
I have one more problem coming up. I am observing that on one of the lines in my line chart, there are random points drawing in which have no value or tooltip. I surely dont have them in my dataset. I have heard that they can be eliminated using the fill scene graph. But is there any other way in which I can remove those null point. Doing them in the fill scene graph is messing up my ps.icons for different lines.
Here is how I am getting rid of them
foreach (DataPoint goodPoint in line.points)
if (goodPoint != null)
if (goodPoint.Value != null)
goodPoint.DataPoint.Label);
dp2[i] = goodPoint;
i++;
But then this is deleting the last point on that polyline which is actually point.
So I am writing the following code to get the last point of the line.
My different lines have different icons. This line is somehow taking the icon from other lines. I am trying to draw a character icon on this line. Here is the code where I am drawing the icons again (I have declared them when I am creating the respective layers itself.)
foreach (Primitive p1 in scene)
if (p1 is PointSet)
PointSet ps = p1 as PointSet;
bool bAllGood = true;
foreach (DataPoint dp in ps.points)
if (dp.Empty)
bAllGood = false;
bool resistance_point = false;
if (bAllGood)
resistance_point = ps.character.ToString().Contains("R");
if (resistance_point)
ps.icon = SymbolIcon.Character;
ps.character = 'R';
ps.font = new Font(FontFamily.GenericSansSerif, (float)13.0);
else
ps.icon = SymbolIcon.Circle;
Your help is deeply appreciated.
I'm having a difficult time picturing this behavior and I've never heard of random points appearing in the line. Can you attach a screenshot and/or provide a sample project to reproduce this problem?
Keeping the last point in the line or any collection can be simply done by using a for loop instead of foreach. Something like (for int i=0; i<points.Length-1; i++). This will leave the last item alone.