Nov 23, 2013, 9:27 AM
[CLOSED] Customize label in stacked columns chart
Hello,
I have a graphic which is displayed as a stacked column chart and need to display labels in the following way:
1) When both series (allocated and non allocated offers) are selected than label should display summary of these series. Thus for the first column I need to display not two labels but only one as a summary (4768+5751 = 10,519). Label should be on the top of each bar
2) When allocated offers are selected I need to display only values of allocated offers
3) When the same for non allocated offers
I know that I can use Renderer for label to provide custom message, but it has a lack of parameters only value to be displayed. How I can determinate that in case of #1 I don't need to show allocated offer but just summarize it together with non allocated and display this result? See attached image and code. Hope I was clear :-)
I have a graphic which is displayed as a stacked column chart and need to display labels in the following way:
1) When both series (allocated and non allocated offers) are selected than label should display summary of these series. Thus for the first column I need to display not two labels but only one as a summary (4768+5751 = 10,519). Label should be on the top of each bar
2) When allocated offers are selected I need to display only values of allocated offers
3) When the same for non allocated offers
I know that I can use Renderer for label to provide custom message, but it has a lack of parameters only value to be displayed. How I can determinate that in case of #1 I don't need to show allocated offer but just summarize it together with non allocated and display this result? See attached image and code. Hope I was clear :-)
<ext:Chart runat="server" Shadow="true" StyleSpec="background:#fff" Animate="true" Flex="1">
<Listeners>
<%--AfterRender Handler="AfterChartRender(item);"></--AfterRender--%>
</Listeners>
<Store>
<ext:Store runat="server" AutoDataBind="true" AutoLoad="true">
<Proxy>
<ext:AjaxProxy Url="/Analysis/GetScenarioResultsOverview">
<Reader>
<ext:JsonReader TotalProperty="total" Root="data" IDProperty="carrierId" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<AutoLoadParams>
<ext:Parameter Name="ScenarioId" Value="<%# Model.ScenarioId %>" Mode="Value" AutoDataBind="true" />
<ext:Parameter Name="TenderId" Value="<%# Model.TenderId %>" Mode="Value" AutoDataBind="true" />
</AutoLoadParams>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="carrierId" Mapping="CarrierId" />
<ext:ModelField Name="carrierName" Mapping="CarrierName" />
<ext:ModelField Name="completeOffer" Type="Float" Mapping="CompleteOffer" />
<ext:ModelField Name="allocationOffer" Type="Float" Mapping="AllocationOffer" />
<ext:ModelField Name="nonAllocatedOffer" Type="Float">
<Convert Handler="return record.get('completeOffer') - record.get('allocationOffer');" />
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="Total" Direction="DESC" />
</Sorters>
<Listeners>
<%--Load Handler="ChartStoreLoad(store, records, successful);"></Load--%>
</Listeners>
</ext:Store>
</Store>
<LegendConfig Position="Bottom" />
<Axes>
<ext:NumericAxis Fields="allocationOffer, nonAllocatedOffer" Grid="true">
<Label>
<%--Renderer Handler="return RenderNumericAxis(value);" /--%>
</Label>
</ext:NumericAxis>
<ext:CategoryAxis Position="Bottom" Fields="carrierName" />
</Axes>
<Series>
<ext:ColumnSeries Axis="Left" Highlight="true" XField="carrierName" YField="allocationOffer, nonAllocatedOffer" Titles="Allocated Offers,Not allocated offers" Stacked="true">
<Tips runat="server" TrackMouse="true" Width="140" Height="28">
<Renderer Handler="this.setTitle(String(item.value[1]) + 'M');" />
</Tips>
<Label Display="Over" Orientation="Vertical" Color="#333" TextAnchor="middle" Field="allocationOffer, nonAllocatedOffer">
<%--Renderer Handler="return 'debugger';" /--%>
</Label>
</ext:ColumnSeries>
</Series>
</ext:Chart>
Last edited by Daniil; Nov 29, 2013 at 2:20 PM.
Reason: [CLOSED]