I'm using Highcharts under C# .NET
I want to include more data to include and show them on Series.
All classes of Series (ColumnSeriesData, PieSeriesData... limit us to a number of a specific fields bellow:
public string ClassName { get; set; }
public string Color { get; set; }
public double? ColorIndex { get; set; }
public Hashtable CustomFields { get; set; }
public PieSeriesDataLabels DataLabels { get; set; }
public string Description { get; set; }
public PieSeriesDataDragDrop DragDrop { get; set; }
public string Drilldown { get; set; }
public PieSeriesDataEvents Events { get; set; }
public string Id { get; set; }
public double? Labelrank { get; set; }
public double? LegendIndex { get; set; }
public string Name { get; set; }
public bool? Selected { get; set; }
public bool? Sliced { get; set; }
public double? Y { get; set; }
How can i add a personalised field ?
Yes, each class in Highcharts.NET or Highstock.NET contains the CustomFields property where you can define fields that will later be thrown in JS. It should be added in pairs: property name and value.
API example: https://dotnet.highcharts.com/Help/Highcharts/html/class_highsoft_1_1_web_1_1_mvc_1_1_charts_1_1_spline_series.html#a911f05a5827c3d33cc5dceb79bb55b24
Related
So initially my class is as follows...
public class ClientTransaction
{
public decimal ClientBalance { get; set; }
public DateTime ClientTransactionDate { get; set; }
public int ClientTransactionTypeId { get; set; }
public string ClientTransactionTypeName { get; set; }
public decimal TransactionAmount { get; set; }
public decimal TaxRate { get; set; }
}
All fields are saved into couchbase.
Then i change the class to add a new field called Description.
public class ClientTransaction
{
public decimal ClientBalance { get; set; }
public DateTime ClientTransactionDate { get; set; }
public int ClientTransactionTypeId { get; set; }
public string ClientTransactionTypeName { get; set; }
public decimal TransactionAmount { get; set; }
public decimal TaxRate { get; set; }
public string Description { get; set; }
}
I populate the description field and do an upsertAsync but the description field is not in the database even though the upsert was a success.
Please advise.
How to Assign the value in one model to another model without using AutoMapper ,foreach,and instance and then it will access any way to send value in one model to another model its is possible and then my source model will be byte array ..
This is my source model...
public class OneDriveItem : OneDriveItemBase
{
public string Id { get; set; }
public string Name { get; set; }
public string ETag { get; set; }
public OneDriveIdentitySet CreatedBy { get; set; }
public DateTimeOffset CreatedDateTime { get; set; }
public OneDriveIdentitySet LastModifiedBy { get; set; }
public DateTimeOffset LastModifiedDateTime { get; set; }
public long Size { get; set; }
public string WebUrl { get; set; }
public OneDriveItem[] Children { get; set; }
public OneDriveRemoteItem RemoteItem{ get; set; }
}
This is my Target Model
public class OneDriveModels
{
public string Id { get; set; }
public string Etag { get; set; }
public string Name { get; set; }
public string WebUrl { get; set; }
public string CTag { get; set; }
public long Size { get; set; }
public DateTime CreatedDateTime { get; set; }
public DateTime LastModifiedDateTime { get; set; }
public string DownloadUrlAnnotation { get; set; }
}
You can decide not to look for a shortcut and do it with a constructor/factory method.
For example:
public class OneDriveModels
{
public static FromOneDriveItem( OneDriveItem source)
{
Id = source.Id
ETag = source.ETag
(...)
}
I'm attempting to deserialize the following json:
{"PatientNameID":{"ID":514,"Name":{"First":"Laura","Middle":"X","Last":"Coelho","Suffix":"","Full":"Laura X Coelho","Preferred":""}},"PatientNumber":"254","ChartNumber":"254","Gender":{"LookupType":"Gender","Code":"F","Description":"Female","Order":1,"Active":true,"AlternateCodes":null},"DOB":"4/9/1953","PhoneNumber":"3521029496","SSN":"*****0161"}
This is the class and subclasses into which I'm trying to deserialize the above JSON:
public class PatientList3
{
public Pat PatientNameID { get; set; }
public string PatientNumber { get; set; }
public string ChartNumber { get; set; }
public Gender2 Gender { get; set; }
public string DOB { get; set; }
public string PhoneNumber { get; set; }
public string SSN { get; set; }
}
public class Pat
{
public int ID { get; set; }
public PtName Name { get; set; }
}
public class PtName
{
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
public string Full { get; set; }
public string Preferred { get; set; }
}
public class Gender2
{
string LookupType { get; set; }
string Code { get; set; }
string Description { get; set; }
int Order { get; set; }
bool Active { get; set; }
List<AlternateCodes> AlternateCodes { get; set; }
}
public class AlternateCodes
{
string Code { get; set; }
string Description { get; set; }
string CodeSystem { get; set; }
string CodeSystemName { get; set; }
}
Everything goes well when I deserialize it except all of the values in the Gender2 class are null.
I've referred to the following two posts for answers but nothing seems to be doing to trick.
JsonConvert.DeserializeObject<T>(JsonString) returning all Properties<T> as Null
DeSerializing JSON returns null C#
Fix the properties on Gender2 & AlternateCodes they are not public! The deserializer will not be able to find your any of your properties so that is probably the reason this fails to populate.
The problem is with access modifiers of properties Gender2 and AlternateCodes class, default access modifiers for properties is private. You should change it to:
public class Gender2
{
public string LookupType { get; set; }
public string Code { get; set; }
public string Description { get; set; }
public int Order { get; set; }
public bool Active { get; set; }
public List<AlternateCodes> AlternateCodes { get; set; }
}
public class AlternateCodes
{
public string Code { get; set; }
public string Description { get; set; }
public string CodeSystem { get; set; }
public string CodeSystemName { get; set; }
}
After setting properties to public it deserializes successfully:
I have an Api returning JSON data as response. This response is basically answers to a survey taken. We have multiple surveys. Each survey will have multiple questions which can be different from the other surveys. (Hope I make sense here)
I have created a model class from the response I get for one of the survey like follows :-
public string value1 { get; set; }
public string value2 { get; set; }
public string value3 { get; set; }
public string value4 { get; set; }
public int FileSystemObjectType { get; set; }
public int Id { get; set; }
public object someUrl1 { get; set; }
public string SomeUrl2 { get; set; }
public string TypeId { get; set; }
public string DifferentValue1 { get; set; }
public bool DifferentValue2 { get; set; }
public List<string> DifferentValue3 { get; set; }
public List<string> DifferentValue4 { get; set;
The properties DifferentValue1, DifferentValue2, DifferentValue3 .. are the questions that can be different for each survey. Right now this survey has 4 questions, but other surveys can have different number of questions. The rest of the properties remain same throughout the surveys.
Eg. Other survey can have a model
public string value1 { get; set; }
public string value2 { get; set; }
public string value3 { get; set; }
public string value4 { get; set; }
public int FileSystemObjectType { get; set; }
public int Id { get; set; }
public object someUrl1 { get; set; }
public string SomeUrl2 { get; set; }
public string TypeId { get; set; }
public string DifferentValue1 { get; set; }
public bool DifferentValue2 { get; set; }
Is there a way I can make a generic model class where the properties for the question can be different but other properties are same?
Any help is appreciated.
Sounds to me like a typical scenario for inheritance..
Create a base class with properties that you want to have for all surveys and then derive from that class and add properties for the individual questions to that child class.
Example:
public class SurveyBase
{
public int Id { get; set; }
public string SomeUrl { get; set; }
public string TypeId { get; set; }
//...
}
public class Survey1 : SurveyBase
{
public string MyQuestion1 { get; set; }
public string MyQuestion2 { get; set; }
//..
}
public class Survey2 : SurveyBase
{
public string OtherProperty { get; set; }
public int Whatever { get; set; }
//..
}
I have an object that has header level details about an order, as well as a list of order details.
The header information populates just fine, but I can't figure out how to bind the list of order details to the tablix that I have on the report.
Is this the wrong approach?
The data connection is being determined at run time, so I don't think I can easily just hook a subreport to a database and pass filters.
Edit: I should add that I have a parent form with a ReportViewer, if it makes a difference. That's where I set the datasource.
public class FormulaHeaderModel
{
public string flavor { get; set; }
public string name { get; set; }
public string author { get; set; }
public string formulaId { get; set; }
public string formulaNumber { get; set; }
public string formulaType { get; set; }
public string accessLevel { get; set; }
public string createdOnDate { get; set; }
public string formulaWeight { get; set; }
public string note { get; set; }
public List<FormulaDetailModel> dataCharacterizing { get; set; }
public List<FormulaDetailModel> dataContributory { get; set; }
public List<FormulaDetailModel> dataGlobal { get; set; }
public List<FormulaDetailModel> dataCarrier { get; set; }
}
public class FormulaDetailModel
{
public int formulaID { get; set; }
public int ingredientTypeId { get; set; }
public string codeFema { get; set; }
public decimal ingredientCost { get; set; }
public string name { get; set; }
public string natural { get; set; }
public decimal ppm { get; set; }
public decimal percentSolution { get; set; }
public decimal grams {get; set;}
}
I need to have a tablix for each of the lists.
So the top is the string level info, then a label and tablix(or whatever really) for each of the 4 FormulaDetailModel lists.
Got it. I can add a second datasource as long as the name matches the dataset name that the table is set for.
this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FormulaDetailModel", fhModel.dataCharacterizing ));