Jump to content

 

Photo

Do you support dynamic series?


  • Please log in to reply
9 replies to this topic

#1 marks

marks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 05 April 2012 - 10:53 PM

I am trying to move from ComponentArt to your product.

One thing that I need is the ability to create chart series based on the results of a query. For example, I can run a query one time and get:

Account Date Amount
------- ---- -------
Rent 1/1/2012 800
Fuel 1/1/2012 150
Paper 1/1/2012 200

and run a 2nd time and get:

Account Date Amount
------- ---- -------
Rent 1/1/2012 800
Water 1/1/2012 100

So, I don't how many series there will be, or what the names are.

With ComponentArt, the 'SeriesPath' property handles this and a new series is generated for each value in the SeriesPath field.

Please let me know if you provide this feature.

Thanks,
Mark

#2 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,587 posts
  • Gender:Male
  • Location:Bangalore

Posted 06 April 2012 - 04:56 AM

Mark,

There are multiple ways by which you can achieve this. You can either create the series inside a loop depending upon the result-set.

Example:
foreach(var data in list) // Here list is the collection (result-set)
{
    DataSeries ds = new DataSeries();
    ..
    ..
    chart.Series.Add(ds);
}

Or

You can work with multi-series DataBinding following MVVM pattern. Please check out the below example for more info.
http://www.visifire.com/documentation/Visifire_Documentation/Charts/Core_Concepts/Working_with_DataBinding/working_with_multiseries_databinding.htm

Regards,
Vivek
Team Visifire


#3 marks

marks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 06 April 2012 - 03:38 PM

Thanks! That looks like what I am looking for.

Mark

#4 marks

marks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 06 April 2012 - 05:45 PM

I am trying get this working in a LightSwitch project and I have not quite got it working. I have created a sample application, and I do have the chart basically working, but I have not been able to get the dynamic series to work; I am trying to get a new series for each different 'Account'. Right now, I am getting one series. Can you please help with what I need to add to the XAML?

Here is my current XAML:
<UserControl x:Class="LightSwitchApplication.Charts.Chart1"
xmlns="http://schemas.micro...l/presentation"
xmlns:x="http://schemas.micro...infx/2006/xaml"
xmlns:d="http://schemas.micro...ion/blend/2008"
xmlns:mc="http://schemas.openx...atibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="600">

<Grid x:Name="LayoutRoot" Background="White">
<vc:Chart xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts" Width="600" Height="300" BorderThickness="0" Theme="Theme1"
ToolBarEnabled="True" >
<vc:Chart.Titles>
<vc:Title Text="LightSwitch Test" />
</vc:Chart.Titles>
<vc:Chart.Series>
<vc:DataSeries RenderAs="Spline" LegendText="{Binding Account}" DataSource="{Binding Screen.Table1Items}" >
<vc:DataSeries.DataMappings>
<vc:DataMapping MemberName="AxisXLabel" Path="TranDate"/>
<vc:DataMapping MemberName="YValue" Path="TranAmount" />
</vc:DataSeries.DataMappings>
</vc:DataSeries>
</vc:Chart.Series>
</vc:Chart>
</Grid>
</UserControl>

Here is the chart I am getting:

Posted Image

Here is the screen definition in LightSwitch:

Posted Image

Thanks,
Mark

#5 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,587 posts
  • Gender:Male
  • Location:Bangalore

Posted 09 April 2012 - 04:56 AM

Mark,

You can try adding another series inside the Series collection of chart.

Example:

<Grid x:Name="LayoutRoot" Background="White">
<vc:Chart xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts" Width="600" Height="300" BorderThickness="0" Theme="Theme1"
ToolBarEnabled="True" >
<vc:Chart.Titles>
<vc:Title Text="LightSwitch Test" />
</vc:Chart.Titles>
<vc:Chart.Series>
First series
<vc:DataSeries RenderAs="Spline" LegendText="{Binding Account}" DataSource="{Binding Screen.Table1Items}" >
<vc:DataSeries.DataMappings>
<vc:DataMapping MemberName="AxisXLabel" Path="TranDate"/>
<vc:DataMapping MemberName="YValue" Path="TranAmount" />
</vc:DataSeries.DataMappings>
</vc:DataSeries>
Second series. Here you can change the Path for AxisXLabel and YValue. You can also change the DataSource of DataSeries.
<vc:DataSeries RenderAs="Spline" LegendText="{Binding Account}" DataSource="{Binding Screen.Table1Items}" >
<vc:DataSeries.DataMappings>
<vc:DataMapping MemberName="AxisXLabel" Path="TranDate"/>
<vc:DataMapping MemberName="YValue" Path="TranAmount" />
</vc:DataSeries.DataMappings>
</vc:DataSeries>
</vc:Chart.Series>
</vc:Chart>
</Grid>

Regards,
Vivek
Team Visifire


#6 marks

marks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 12 April 2012 - 09:47 PM

Thanks for the response, but I need to be able to add data series dynamically, becuase I don't know how many there will be until the query is run.

I am trying to get this working in a LightSwitch project. I tried to get the code sample that includes the MultiChart to work in my project, but I could not get it to work in LightSwitch.

Is it possible for you to help me to get this to work with LightSwitch? This is the last thing that I need to figure out before I buy your product.

(Attached File  mark-sutton-lightswitch.zip   240.01K   3 downloadsI have attached a sample project.)

Thanks very much,
Mark

#7 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,587 posts
  • Gender:Male
  • Location:Bangalore

Posted 13 April 2012 - 11:46 AM

Mark,

We will look into your code and get back to you.

Regards,
Vivek
Team Visifire


#8 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 16 April 2012 - 10:29 AM

Hi Mark,

We have modified LightSwitch project with MVVM sample code. Please have a look. You can further modify this sample depending upon your requirement.

Regards,
Shoaib

Attached Files



#9 marks

marks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 17 April 2012 - 04:10 PM

Thank you very much. I am trying to take your sample and change the data binding to bind to the Screen view model in LightSwitch. I have not gotten it to work yet, but I will keep trying.

Mark

#10 Xelom

Xelom

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts

Posted 11 May 2012 - 01:56 PM

Hi Mark,

I made dynamic series with Visifire before. And had a conversation with Vivek about it. It can be found here: http://www.visifire....719

And this example was the exact one for me: http://www.visifire....tails.php?id=34

If it is similar to your one, also take a look at Vivek's modified code to make it run in my topic.

Regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users