[CLOSED] Config style pie chart

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Config style pie chart

    Hello, I have a question, I would like to know how to personalize my chart, I would like it to appear as it is in the legend, but in the "Chart Label" I want the percentage to appear.

    Is it possible to make these modifications?

    Click image for larger version. 

Name:	Chart.PNG 
Views:	84 
Size:	31.6 KB 
ID:	25317
    Last edited by fabricio.murta; Mar 26, 2020 at 7:16 PM.
  2. #2
    Hello @pvera!

    We have several Charts examples showing various ways to personalize your charts. You may start here: Chart > Pie > Renderer

    You will not find -all- you can do with pie charts just within the pie examples though. For instance, up in the line charts example you will find one showing how you can apply a custom format to the chart labels imprinted by using a renderer. Here's the example: Chart > Column > Limit.

    You may want to consider browsing the different chart samples around these to find out even more!..

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi fabricio,

    Thanks for answering but that does not solve my question, I am using a "Pie Chart" with a legend, when trying to change the label text it affects my legend.

    I have attached the example link, I am using Ext Net MVC.

    https://mvc.ext.net/#/Chart_Pie/Basic/
  4. #4
    Hello, any answer to my question.
    It is important, please your understanding.
  5. #5
    Hello @pvera!

    You should almost always provide sample test case to illustrate your scenario so we can better understand and provide help to you. You just pointed a bare MVC example, with no indications how you tried to change the label in the sample's code.

    There's an MVC usage scenario that I believe matches your needs in the Chart > Misc > Captions example. Open its source code and scroll down to the last block where it defines a .Label() with a .Renderer() within. There, it returns a number transformation with Ext.util.Format.number(text, '0');; you probably want just text + "%".

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  6. #6
    Hello Fabricio

    Sorry for not being clear, I explain myself again,
    what I want is to change the name of the label, I want the text that changes in the piece of the graph to show the percentage, try to change the Field attribute with the value but the graph is out of place.

    I attach the code and the image of the result that shows me when changing the mentioned value.

    Check lines 192 and 197 .

    I await your quick response please.

    Image result
    Click image for larger version. 

Name:	Chart.PNG 
Views:	49 
Size:	5.3 KB 
ID:	25321

    View
    @(Html.X().Viewport()
            .ID("ViewPortKPI")
            .Layout(LayoutType.Border)
            .PaddingSpec("10 10 10 10")
            .Items(
                         Html.X().FormPanel()
                         .ID("FilterDatPanel")
                         .Title("Filtros")
                         .Region(Region.North)
                         .ColumnWidth(0.25)
                         .BodyPadding(25)
                         .Frame(true)
                         .Layout(LayoutType.Column)
                         .FieldDefaults((fd) =>
                         {
                             fd.MsgTarget = MessageTarget.Side;
                             fd.LabelWidth = 190;
                             fd.LabelStyle = "font-weight:bold;";
                         })
                         .Buttons(
                             Html.X().Button()
                                 .Text("Filtrar")
                                 .Disabled(true)
                                 .FormBind(true)
                                 .IconCls("x-fa fa-search")
                                 .ToolTip("<b> Busca Manifiestos </br>")
                                 .DirectEvents(de =>
                                 {
                                     de.Click.Url = Url.Action("FilterData");
                                     de.Click.EventMask.ShowMask = true;
                                     //de.Click.FormID = "FilterDatPanel";
                                     de.Click.Success = "onSuccess(App.ManifestPieChart,App.ManifestBarChart,result);";
                                 })
                         )
                         .Items(
                            Html.X().FieldContainer()
                            .FieldDefaults((fd) => fd.LabelAlign = LabelAlign.Left)
                            .DefaultAnchor("100%")
                            .ColumnWidth(0.25)
                            .Items(
                                Html.X().ComboBoxFor(m => m.ReportRequest.VCH_FIRSTCOLUMN)
                                .FieldLabel("Var. Cualitativa")
                                .ID("QualitativeCombo")
                                .EmptyText("Seleccione una variable")
                                .Items(Model.QualitativeList),
                                Html.X().DateFieldFor(m => m.ReportRequest.DAT_STARTDATE).ID("StartDateField").FieldLabel("Fecha Desde").MaxDate(DateTime.Today)
                                ),
                                Html.X().FieldContainer()
                                .ColumnWidth(0.25)
                                .Items(
                                    Html.X().ComboBoxFor(m => m.ReportRequest.VCH_FILTER)
                                    .FieldLabel("Filtro")
                                    .ID("FilterCombo")
                                    .EmptyText("Seleccione una opción")
                                    .Items(Model.OptionList),
                                    Html.X().DateFieldFor(m => m.ReportRequest.DAT_ENDDATE).ID("EndDateField").FieldLabel("Fecha Hasta").MaxDate(DateTime.Today)
                                    ),
                                Html.X().FieldContainer()
                                .ColumnWidth(0.25)
                                .Items(
                                    Html.X().ComboBoxFor(m => m.ReportRequest.VCH_SECONDCOLUMN)
                                    .FieldLabel("Var. Cuantitativa")
                                    .ID("QuantitativeCombo")
                                    .Editable(false)
                                    .QueryMode(DataLoadMode.Local)
                                    .TriggerAction(TriggerAction.All)
                                    .EmptyText("Seleccione una variable")
                                    .Items(Model.QuantitativeList),
                                    Html.X().FieldContainer()
                                    .Layout(LayoutType.Column)
                                    .Items(
                                        Html.X().ComboBoxFor(m => m.ReportRequest.INT_YEAR).ID("YearsCombo").FieldLabel("Año/Sem.Desde/Sem.Hasta").Items(Model.ListYears).ColumnWidth(0.33).Width(265)
                                        .SelectedItems(new Ext.Net.ListItem() { Value = DateTime.Now.Year.ToString() }),
                                        Html.X().NumberFieldFor(m => m.ReportRequest.INT_STARTWEEK).ID("StartWeek").MinValue(1).MaxValue(52).HideLabel(true).ColumnWidth(0.33).Width(58),
                                        Html.X().NumberFieldFor(m => m.ReportRequest.INT_ENDWEEK).ID("EndWeek").MinValue(1).MaxValue(52).HideLabel(true).ColumnWidth(0.33).Width(58) )
                                    ),
                               Html.X().FieldContainer()
                                .ColumnWidth(0.15)
                                .Items(
                                    Html.X().NumberFieldFor(m => m.ReportRequest.INT_TOPREGISTERS).ID("TopRegisters").FieldLabel("Top registros").MinValue(1).MaxValue(1000)
                                    )
                                    ),
                            Html.X().Panel()
                            .ID("ChartPanel")
                            .Region(Region.Center)
                            .Hidden(true)
                            .Layout(LayoutType.Fit)
                            .MarginSpec("25px 0 25px 0")
                            .Scrollable(ScrollableOption.Vertical)
                            .Items(
                                Html.X().Panel()
                                .ID("BarChartPanel")
                                .Width(500)
                                .Height(800)
                                .Padding(50)
                                .Layout("fit")
                                .TopBar(Html.X().Toolbar()
                                .Items(
                                    Html.X().ToolbarFill(),
    
                                    Html.X().Button()
                                        .Text("Guardar Gráfico")
                                        .Icon(Icon.Disk)
                                        .Handler("saveChart(this,'cartesian');")
    
                                 )
                            )
                                 .Items(
                                     Html.X().CartesianChart()
                                     .ID("ManifestBarChart")
                                     .FlipXY(true)
                                     .InsetPadding(40)
                                     .Height(200)
                                     .Theme("custom-theme")
                                     .AnimationConfig(new AnimConfig { Duration = 500, Easing = Easing.EaseOut })
                                     .Store(Html.X().Store()
                                         .Model(Html.X().Model()
                                             .Fields(
                                                 Html.X().ModelField().Name("VCH_PROPERTY"),
                                                 Html.X().ModelField().Name("DEC_PERCENT"),
                                                 Html.X().ModelField().Name("DEC_VALUE")
                                             )
                                         )
                                     )
                                     .Axes(
                                         Html.X().NumericAxis()
                                             .Fields("DEC_PERCENT")
                                             .Position(Position.Bottom)
                                             .Grid(true)
                                             .Maximum(100)
                                             .Renderer(r => r.Handler = "return label.toFixed(0) + '%';"),
    
                                         Html.X().CategoryAxis()
                                             .Position(Position.Left)
                                             .Fields("VCH_PROPERTY")
                                             .Grid(true)
                                     )
                                     .Series(Html.X().BarSeries()
                                         .XField("VCH_PROPERTY")
                                         .YField("DEC_PERCENT")
                                         .StyleSpec(Html.X().SeriesSprite().Opacity(0.8).MinGapWidth(10))
                                                 .HighlightConfig(Html.X().Sprite().FillStyle("#3498DB").StrokeStyle("black").LineWidth(2))
                                         .Tooltip(Html.X().ChartTip()
                                             .TrackMouse(true)
                                             .Renderer(r => r.Handler = "toolTip.setHtml(record.get('VCH_PROPERTY') + ': ' + record.get('DEC_PERCENT') + '%');")
                                         )
                                         .Label(Html.X().ChartLabel()
                                         .FontSize("12")
                                         .FontFamily("Arial")
                                         .Display(SeriesLabelDisplay.Over).Field("DEC_VALUE"))
    
                                     )
                                ),
                                Html.X().Panel()
                                .ColumnWidth(0.5)
                                .Width(900)
                                .Height(900)
                                .ID("P1")
                                .Layout(LayoutType.Fit)
                                .Region(Region.Center)
                                .TopBar(Html.X().Toolbar()
                                    .Items(
                                        Html.X().ToolbarFill(),
    
                                        Html.X().Button()
                                            .Text("Guardar Gráfico")
                                            .Icon(Icon.Disk)
                                            .Handler("saveChart(this,'polar')")
    
                                        )
                                )
                                .Padding(50)
                                .Items(
                                        Html.X().PolarChart()
                                        .ID("ManifestPieChart")
                                        .Flex(1)
                                        .Shadow(true)
                                        .Theme("custom-theme")
                                        .InsetPadding(5)
                                        .Layout(LayoutType.Fit)
                                        .InnerPadding(50)
                                        .LegendConfig(Html.X().ChartLegend().Dock(Dock.Right))
                                        .Interactions(
                                            Html.X().ItemHighlightInteraction(),
                                            Html.X().RotateInteraction()
                                        )
                                        .Store(Html.X().Store()
                                            .Model(Html.X().Model().Fields("VCH_PROPERTY", "DEC_VALUE","DEC_PERCENT"))
                                        )
    
                                        .Series(Html.X().PieSeries()
                                            .AngleField("VCH_PROPERTY")
                                            .ShowInLegend(true)
                                            .Donut(20)
                                            .HighlightMargin(80)
                                            .Label(Html.X().ChartLabel()
                                                .Field("DEC_PERCENT")
                                                .Display(SeriesLabelDisplay.InsideEnd)
                                                .FontSize("12")
                                                .FontFamily("Arial")
                                                .Width(50)
    
                                            )
                                        .Tooltip(Html.X().ChartTip()
                                            //.TrackMouse(false)
                                            //.Width(140)
                                            //.Height(28)
                                            .Layout(LayoutType.Fit)
                                            .Renderer(r => r.Fn = "tipRenderer")
                                        )
    
                                        )
                            )
                        )
                 //),
                 )
                )
  7. #7
    Hi,

    Someone, Please I need an answer.
    Last edited by pvera; Mar 24, 2020 at 6:52 AM.
  8. #8
    Hello @pvera!

    We are doing our best to reply within 24hs from your post, but sometimes due to time zone differences and other issues, we simply can't reply within 5 hours.

    I don't know what you mean with the .AngleField("VCH_PROPERTY") in line 192.

    For what I see you point in line 197, .Field("DEC_PERCENT"), you are trying to show the percentual value (of what is shown in the angle field pointed by line 192?).

    And that would be within that label I believe you want to add the percent sign, no? You probably should add the following to line 202 (it is currently blank, so it is the perfect place):

    .Renderer(r => r.Handler = "return text + '%'")
    Your test case is not runnable, we would need it to have all information to run, you didn't provide the controller code with the mock data for the fields you show in the code block. Please provide full view and controller (and model if required) of the simplified scenario, so we can run the code on our side. Notice we don't want full proprietary code, we just need a test case highlighting the feature you need and can't make work. Or as close as you could get.

    In case you didn't already, please review our three topics on guidelines on posting sample code and new posts.
    - Tips for creating simplified code samples
    - More Information Required
    - Forum Guidelines

    We are eager to help you, but if we can't see what you're facing in code, it is hard to make good guesses on how to effectively help you.

    Hope you understand.
    Fabrício Murta
    Developer & Support Expert
  9. #9
    Hello fabricio

    Hello Fabricio,

    I understand the situation, sorry for the insistence is that it is important.

    Let me explain, those lines that I indicate are those that I modify to want to see the value of the percentage that is the DEC_PERCENT field in the piece of the foot and in the legend that appears the values ​​of the property VCH_PROPERTY, but this did not work, that is why my doubt , I attach an image so that you understand what you are really looking for.

    I can't put all the code because this queries an API.

    I enclose the view, controller and model code


    Image of what you are looking for
    Click image for larger version. 

Name:	chart2.jpg 
Views:	69 
Size:	67.2 KB 
ID:	25323

    View

    @model SLINETWEB.ViewModels.ManifestModule.ReportViewModel
    @{
        ViewBag.Title = "Index";
        Layout = "~/Views/Shared/_BaseLayout.cshtml";
    }
    @section scripts{
            <script>
            var tipRenderer = function (toolTip, storeItem, item) {
                var total = 0;
                var percent = storeItem.get('DEC_PERCENT');
                toolTip.setTitle(storeItem.get('VCH_PROPERTY') + ': ' + percent.toFixed(2) + '%');
                };
    
                var saveChart = function (btn, chart) {
                                console.log("btn",btn)
    
                console.log("CHART",chart)
                Ext.MessageBox.confirm('Confirmar Descarga', '¿Desea descargar el gráfico como una imagen?', function (choice) {
                    if (choice === 'yes') {
                        btn.up('panel').down(chart).download();
    
                    }
                });
                };
    
                var onSuccess = function (chart1,chart2,result) {
                //console.log(grid.getStore());
                console.log("data",result.data)
    
                    chart1.getStore().loadData(result.data);
                    //chart1.getStore().totalCount = result.total
                    chart2.getStore().loadData(result.data);
    
                    App.ChartPanel.show();
                //chart2.getStore().totalCount = result.total
            };
        </script>
        }
    @(Html.X().ChartTheme()
    .ThemeName("custom-theme")
    .Colors(new string[] { "#1ABC9C","#F1C40F","#3498DB","#C0392B","#9B59B6","#FF8543","#09D0E7","#FF469A","#7CE538" })  
    
    )
    @(Html.X().Viewport()
            .ID("ViewPortKPI")
            .Layout(LayoutType.Border)
            .PaddingSpec("10 10 10 10")
            .Items(
                         Html.X().FormPanel()
                         .ID("FilterDatPanel")
                         .Title("Filtros")
                         .Region(Region.North)
                         //.ColumnWidth(0.25)
                         .BodyPadding(25)
                         .Frame(true)
                         .Layout(LayoutType.Column)
                         .FieldDefaults((fd) =>
                         {
                             fd.MsgTarget = MessageTarget.Qtip;
                             fd.LabelWidth = 190;
                             fd.LabelStyle = "font-weight:bold;";
                         })
                         .Buttons(
                             Html.X().Button()
                                 .Text("Filtrar")
                                 .Disabled(true)
                                 .FormBind(true)
                                 .IconCls("x-fa fa-search")
                                 .ToolTip("<b> Busca Manifiestos </br>")
                                 .DirectEvents(de =>
                                 {
                                     de.Click.Url = Url.Action("FilterData");
                                     de.Click.EventMask.ShowMask = true;
                                     //de.Click.FormID = "FilterDatPanel";
                                     de.Click.Success = "onSuccess(App.ManifestPieChart,App.ManifestBarChart,result);";
                                 })
                         )
                         .Items(
                            Html.X().FieldContainer()
                            .FieldDefaults((fd) => fd.LabelAlign = LabelAlign.Left)
                            //.DefaultAnchor("100%")
                            .ColumnWidth(0.25)
                            .Items(
                                Html.X().ComboBoxFor(m => m.ReportRequest.VCH_FIRSTCOLUMN)
                                .FieldLabel("Var. Cualitativa")
                                .ID("QualitativeCombo")
                                .EmptyText("Seleccione una variable")
                                .Items(Model.QualitativeList),
                                Html.X().DateFieldFor(m => m.ReportRequest.DAT_STARTDATE).ID("StartDateField").FieldLabel("Fecha Desde").MaxDate(DateTime.Today)
                                ),
                                Html.X().FieldContainer()
                                .ColumnWidth(0.25)
                                .Items(
                                    Html.X().ComboBoxFor(m => m.ReportRequest.VCH_FILTER)
                                    .FieldLabel("Filtro")
                                    .ID("FilterCombo")
                                    .EmptyText("Seleccione una opción")
                                    .Items(Model.OptionList),
                                    Html.X().DateFieldFor(m => m.ReportRequest.DAT_ENDDATE).ID("EndDateField").FieldLabel("Fecha Hasta").MaxDate(DateTime.Today)
                                    ),
                                Html.X().FieldContainer()
                                .ColumnWidth(0.25)
                                .Items(
                                    Html.X().ComboBoxFor(m => m.ReportRequest.VCH_SECONDCOLUMN)
                                    .FieldLabel("Var. Cuantitativa")
                                    .ID("QuantitativeCombo")
                                    .Editable(false)
                                    .QueryMode(DataLoadMode.Local)
                                    .TriggerAction(TriggerAction.All)
                                    .EmptyText("Seleccione una variable")
                                    .Items(Model.QuantitativeList)
                                    .Width(381),
                                    Html.X().FieldContainer()
                                    .Layout(LayoutType.Column)
                                    .Items(
                                        Html.X().ComboBoxFor(m => m.ReportRequest.INT_YEAR).ID("YearsCombo").FieldLabel("Año/Sem.Desde/Sem.Hasta").Items(Model.ListYears).ColumnWidth(0.33).Width(265)
                                        .SelectedItems(new Ext.Net.ListItem() { Value = DateTime.Now.Year.ToString() }),
                                        Html.X().NumberFieldFor(m => m.ReportRequest.INT_STARTWEEK).ID("StartWeek").MinValue(1).MaxValue(52).HideLabel(true).ColumnWidth(0.33).Width(58),
                                        Html.X().NumberFieldFor(m => m.ReportRequest.INT_ENDWEEK).ID("EndWeek").MinValue(1).MaxValue(52).HideLabel(true).ColumnWidth(0.33).Width(58) )
                                    ),
                               Html.X().FieldContainer()
                                .ColumnWidth(0.15)
                                .Items(
                                    Html.X().NumberFieldFor(m => m.ReportRequest.INT_TOPREGISTERS).ID("TopRegisters").FieldLabel("Top registros").MinValue(1).MaxValue(1000)
                                    )
                                    ),
                            Html.X().Panel()
                            .ID("ChartPanel")
                            .Region(Region.Center)
                            .Hidden(true)
                            .Layout(LayoutType.Fit)
                            .MarginSpec("25px 0 25px 0")
                            .Scrollable(ScrollableOption.Vertical)
                            .Items(
                                Html.X().Panel()
                                .ID("BarChartPanel")
                                //.Width(100)
                                //.Height(100)
                                .PaddingSpec("10px 20px 0 0")
                                .Layout(LayoutType.Fit)
                                .TopBar(Html.X().Toolbar()
    
                                .Items(
                                    Html.X().ToolbarFill(),
    
                                    Html.X().Button()
                                        .Text("Guardar Gráfico")
                                        .Icon(Icon.Disk)
                                        .Handler("saveChart(this,'cartesian');")
    
                                 )
                            )
                                 .Items(
                                     Html.X().CartesianChart()
                                     .ID("ManifestBarChart")
                                     .FlipXY(true)
                                    .InsetPadding(20)
                                    .Flex(1)
                                     .Theme("custom-theme")
                                     .Layout(LayoutType.Fit)
                                     .AnimationConfig(new AnimConfig { Duration = 500, Easing = Easing.EaseOut })
                                     .Store(Html.X().Store()
                                         .Model(Html.X().Model()
                                             .Fields(
                                                 Html.X().ModelField().Name("VCH_PROPERTY"),
                                                 Html.X().ModelField().Name("DEC_PERCENT"),
                                                 Html.X().ModelField().Name("DEC_VALUE")
                                             )
                                         )
                                     )
                                     .Axes(
                                         Html.X().NumericAxis()
                                             .Fields("DEC_PERCENT")
                                             .Position(Position.Bottom)
                                             .Grid(true)
                                             .Maximum(100)
                                             .Renderer(r => r.Handler = "return label.toFixed(0) + '%';"),
    
                                         Html.X().CategoryAxis()
                                             .Position(Position.Left)
                                             .Fields("VCH_PROPERTY")
                                             .Grid(true)
                                     )
                                     .Series(Html.X().BarSeries()
                                         .XField("VCH_PROPERTY")
                                         .YField("DEC_PERCENT")
                                         .StyleSpec(Html.X().SeriesSprite().Opacity(0.8).MinGapWidth(5))
                                                 .HighlightConfig(Html.X().Sprite().FillStyle("#3498DB").StrokeStyle("#3498DB").LineWidth(2))
                                         //.Renderer(r => r.Handler = "return label.toFixed(0);")
                                         .Tooltip(Html.X().ChartTip()
                                             .TrackMouse(true)
                                             .Renderer(r => r.Handler = "toolTip.setHtml(record.get('VCH_PROPERTY') + ': ' + record.get('DEC_PERCENT') + '%');")
                                         )
                                         .Label(Html.X().ChartLabel()
                                         .FontSize("12")
                                         .FontFamily("Arial")
                                         .Display(SeriesLabelDisplay.Over).Field("DEC_VALUE")
                                         .Renderer(r => r.Handler = "return text.toFixed(2);")
                                         )
    
                                     )
                                )
                             ,
                            Html.X().Panel()
                            .ColumnWidth(0.5)
                            //.Width(1500)
                            //.Height(1500)
                            .ID("P1")
                            .Layout(LayoutType.Fit)
                            //.Region(Region.Center)
                            //.Title("pAAAA")
                            //.Scrollable(ScrollableOption.Horizontal)
                            .TopBar(Html.X().Toolbar()
                                .Items(
                                    Html.X().ToolbarFill(),
    
                                    Html.X().Button()
                                        .Text("Guardar Gráfico")
                                        .Icon(Icon.Disk)
                                        .Handler("saveChart(this,'polar')")
    
                                    )
                            )
                            .PaddingSpec("0px 20px 0 0")
                            .Items(
                                    Html.X().PolarChart()
                                    .ID("ManifestPieChart")
                                    .Flex(1)
                                    .Shadow(true)
                                    .Theme("custom-theme")
                                    .InsetPadding(20)
                                    .InnerPadding(25)
                                    .Layout(LayoutType.Fit)
                                    .LegendConfig(Html.X().ChartLegend().Dock(Dock.Right).Width(50))
                                    //.PaddingSpec("0px 20px 0 0")
                                    .Interactions(
                                        Html.X().ItemHighlightInteraction(),
                                        Html.X().RotateInteraction()
                                    )
                                    .Store(Html.X().Store()
                                        .Model(Html.X().Model().Fields("VCH_PROPERTY", "DEC_VALUE", "DEC_PERCENT"))
                                    )
    
                                    .Series(Html.X().PieSeries()
                                        .AngleField("DEC_PERCENT")
                                        .ShowInLegend(true)
                                        .Donut(20)
                                        .HighlightMargin(20)
                                        .Label(Html.X().ChartLabel()
                                            .Field("VCH_PROPERTY")
                                            .Display(SeriesLabelDisplay.InsideEnd)
                                            .FontSize("12")
                                            .FontFamily("Arial")
                                        //.Width(50)
                                        //.Renderer(r => r.Handler = "return text + '%'")
    
                                        )
                                    .Tooltip(Html.X().ChartTip()
                                        //.TrackMouse(false)
                                        //.Width(140)
                                        //.Height(28)
                                        .Layout(LayoutType.Fit)
                                        .Renderer(r => r.Fn = "tipRenderer")
                                    )
    
                                    )
                        )
                        ) //aki
                          //),
                 )
                )
    Controller
    using Ext.Net;
    using Ext.Net.MVC;
    using SLINETWEB.Helpers;
    using SLINETWEB.Models.ManifestModule.Request;
    using SLINETWEB.Models.ManifestModule.Response;
    using SLINETWEB.Proxy.Manifest;
    using SLINETWEB.ViewModels.ManifestModule;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace SLINETWEB.Controllers.ManifestModule
    {
        public class ReportController : Controller
        {
            private readonly ManifestProxy _proxy;
            public ReportController()
            {
                _proxy = new ManifestProxy();
            }
            // GET: Report
            public ActionResult Index()
            {
                ReportViewModel viewModel = new ReportViewModel();
                viewModel.QualitativeList = new List<ListItem>
                {
                    new ListItem("AerolÃ*nea","VCH_AIRLINE"),
                    new ListItem("Producto","VCH_DESCRIPTION"),
                    new ListItem("Consignatario","VCH_CONSIGNEE"),
                    new ListItem("Destino","VCH_DESTINATION"),
                    new ListItem("Exportador","VCH_SHIPPER"),
                    new ListItem("Otro Agente","VCH_ANOTHERAGENT")
                };
                viewModel.QuantitativeList = new List<ListItem>
                {
                    new ListItem("Peso Manif.","DEC_MANIFESTEDWEIGHT"),
                    new ListItem("Bultos Manif.","INT_MANIFESTEDPACKAGE")
                };
    
                viewModel.OptionList = new List<ListItem> {
                    new ListItem("Sumar","Sumar"),
                    new ListItem("Contar","Contar"),
                };
                viewModel.ListYears = UtilityMethods.GetYearsItemsManif();
    
                return View("~/Views/ManifestModule/Report/Index.cshtml",viewModel);
            }
    
            public ActionResult FilterData(ReportRequest reportRequest)
            {
                if (ModelState.IsValid)
                {
                    var response = System.Threading.Tasks.Task.Run(() => _proxy.GetReportDataAsync(reportRequest));
                    if (response.Result.Code != 200)
                    {
                        UtilityResponse<ReportResponse>.ResponseApiErrors(response.Result);
                        return this.Direct();
                    }
                    else
                    {
                        return this.Store(response.Result.List);
                    }
                }
                else
                {
                    return this.FormPanel(ModelState);
                }
            }
        }
    }
    Model
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    
    namespace SLINETWEB.Models.ManifestModule.Response
    {
        public class ReportResponse
        {
            public string VCH_PROPERTY { get; set; }
            public decimal DEC_VALUE { get; set; }
            public decimal DEC_PERCENT { get; set; }
    
        }
    }
  10. #10
    Hello @pvera!

    You can just provide a few lines as a "static fictional result" of your data, we don't need all the airlines just to make the display show what we need, neither a database connection, right?

    What I mean is, we could have a sample data of just:

    new List<ReportResponse>()
    {
        new ResportResponse
        {
            VCH_PROPERTY = "AIRLINE1",
            DEC_VALUE = "8.3",
            DEC_PERCENT = "20.1"
        },
        new ResportResponse
        {
            VCH_PROPERTY = "AIRLINE2",
            DEC_VALUE = "13.5",
            DEC_PERCENT = "49.8"
        },
        new ResportResponse
        {
            VCH_PROPERTY = "AIRLINE3",
            DEC_VALUE = "11.8",
            DEC_PERCENT = "30.1"
        }
    }
    Don't you agree? Would there be anything you would change about this sample, mock data to represent your test case?

    I'm trying right now to get something out of this sample you provided and will be back in a while.
    Last edited by fabricio.murta; Mar 25, 2020 at 8:34 PM. Reason: change 'AIRLINE1' field in the different entries
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Pie Chart
    By CanopiusApplications in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 19, 2016, 4:11 PM
  2. Pie Chart
    By CanopiusApplications in forum 2.x Help
    Replies: 0
    Last Post: Dec 15, 2016, 12:35 PM
  3. Problem in Pie chart
    By thanhnv2104 in forum 3.x Help
    Replies: 3
    Last Post: Jan 20, 2016, 6:25 PM
  4. Pie Chart from Code Behind
    By devgaipp in forum 2.x Help
    Replies: 0
    Last Post: Sep 18, 2012, 12:29 PM
  5. Pie chart example
    By Gamerome in forum 2.x Help
    Replies: 2
    Last Post: Sep 09, 2012, 7:17 PM

Posting Permissions